刚好碰到 ,顺便试了下,有需要的朋友可以看看。
uses TypInfo;
type
TOrderType = (otFN,otGR,otSZ);
var
pi:PTypeInfo;
i:Integer; ot:TOrderType; s:String;
begin
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;
delphi中遍历枚举类型的方法
最新推荐文章于 2025-03-04 21:40:06 发布
本文展示了如何使用Delphi代码片段解析枚举类型,并通过案例演示了获取枚举值对应名称的方法。
551

被折叠的 条评论
为什么被折叠?



