朝花朝拾

朝花昔时杯中酒

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
For example, if you have the some enum type

TyourEnumType = (One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten)

and you want in run-time to get a string with same value for each of them (for example, fill the combobox items with enum values), then you can use the next procedure:
uses TypInfo;

var i: Integer;
begin
  for i := Ord(Low(TyourEnumType)) to Ord(High(TyourEnumType)) do
    Combobox1.Items.Add(GetEnumName(TypeInfo(TyourEnumType), i));
end;

 

posted on 2015-05-10 23:31  朝花朝拾  阅读(204)  评论(1编辑  收藏  举报