遍历枚举类型

uses TypInfo; {以 TAlign 为例} procedure TForm1.Button1Click(Sender: TObject); var enum: TAlign; i: Integer; str: string; begin Memo1.Clear; for enum := Low(TAlign) to High(TAlign) do begin i := ord(enum); //Integer(enum) str := GetEnumName(TypeInfo(TAlign), i); Memo1.Lines.Add(Format('%d : %s', [i, str])); end; end; {************* 0 : alNone 1 : alTop 2 : alBottom 3 : alLeft 4 : alRight 5 : alClient 6 : alCustom **************}

 

 

你可能感兴趣的:(Integer)