枚举可以这样遍历


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

原文地址:https://www.cnblogs.com/del/p/1998955.html