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
**************}

posted on 2011-03-29 16:39  万一  阅读(3589)  评论(0编辑  收藏  举报