如:
 有一个radioGroup,Items分别是form的BorderStyle的几个枚举项
选中其中一选项后,form的BorderStyle发生相应变化,怎么实现呢?查了查资料发现有typeinfo和GetEnmuValue等几个函数,不太会用,请教我一下,谢谢!

解决方案 »

  1.   

    没错、正是用GetEnumValue:
    uses typInfo;BorderStyle := TBorderStyle(GetEnumValue(TypeInfo(TBorderStyle),
        RadioGroup1.Items[RadioGroup1.ItemIndex]));
      

  2.   

    能否介绍一下GetEnumValue ,GetEnumName , TypeInfo, uses typInfo;
      

  3.   

    typInfo是个很好用的单元、提供动态访问RTTI(运行期间类信息)的函数、至于那两个GetEnumValue、GetEnumName函数、自己看一下帮助吧:
    Use GetEnumValue to convert the string that represents an enumerated value into the corresponding integer that is its implemented value.TypeInfo is the type information record that describes the enumerated type. You can obtain the type information for a type by calling the TypeInfo function in Delphi or using the __delphirtti operator in C++.Name is the string that is used in code to represent the enumerated value.GetEnumValue returns the corresponding integer value.