zoukankan      html  css  js  c++  java
  • Delphi枚举类型与整形的转换示例

    Delphi枚举类型与整形的转换示例

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, Buttons, TypInfo;

    type
    TDemoType = (dta, dtb, dtc);

    TForm1 = class(TForm)
        BitBtn1: TBitBtn;
        Edit1: TEdit;
        procedure BitBtn1Click(Sender: TObject);
    private
        {Private declarations}
        aDemoType: TDemoType;
    public
        {Public declarations}
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
    aDemoType := TDemoType(StrToInt(Edit1.Text));
    ShowMessage(GetEnumName(TypeInfo(TDemoType),Ord(aDemoType)));
    end;

    end.

  • 相关阅读:
    c# 不常用逻辑运算符
    c# 简单日志记录类 log

    最短路径
    A+B
    floyd 算法
    Kruskal 算法
    快排
    顺序表的逆排
    顺序表中多余元素的删除
  • 原文地址:https://www.cnblogs.com/luckForever/p/7255121.html
Copyright © 2011-2022 走看看