刚好碰到 ,顺便试了下,有需要的朋友可以看看。
uses TypInfo;
type
TOrderType = (otFN,otGR,otSZ);
var
pi:PTypeInfo;
i:Integer; ot:TOrderType; s:String;
pi:= TypeInfo(TOrderType);
with GetTypeData(pi)^ do
begin
for i := MinValue to MaxValue do
begin
s := GetEnumName(pi,i);
case TOrderType(GetEnumValue(pi,s)) of
otFN : ShowMessage('otFN');
otGR: ShowMessage('otGR');
otSZ: ShowMessage('otSZ');
end;
end;
end;
end;