以下为D自带帮助中的说明,备存怕忘记
uses TypInfo ;
function GetEnumName(TypeInfo: PTypeInfo; Value: Integer): string;
Returns the name of a Delphi enumerated type constant given its value.
Use GetEnumName to convert a Delphi enumerated value into the symbolic name that represents it in code.
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 the __delphirtti operator in C++.
Value is the enumerated value, represented as an integer.
GetEnumName returns the string that represents the specified value.
eg.
GetEnumName(TypeInfo(TParamType), Ord(mParam.ParamType)
--******************************************
function GetEnumValue(TypeInfo: PTypeInfo; const Name: string): Integer;
Returns the value of an enumerated type constant given its string representation.
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++.
The Name argument should contains a string representation of an enumerated type constant. GetEnumValue uses a case-insensitive match.
GetEnumValue returns the corresponding integer value, or -1 if Name does not match any constant in the supplied TypeInfo.
eg.
TParamType(GetEnumValue(TypeInfo(TParamType), 'ptInput'))