好像是这个 function GetEnumName(TypeInfo: PTypeInfo; Value: Integer): string; 怎么用自己看帮助
type TM=(one,two,three,four,five,six); TS = set of TM;procedure TForm1.Button1Click(Sender: TObject); var T: TM; S: TS; begin S := [one,two,three]; for T := Low(T) to High(T) do if T in S then Edit1.Text:=GetEnumName(TypeInfo(TM), Ord(T)); end;
我用的是集合的办法。有更简单的方法: type TM=(one,two,three);procedure TForm1.Button1Click(Sender: TObject); var T: TM; begin T:=two; Edit1.Text:=GetEnumName(TypeInfo(TM), Ord(T));//two end;
function GetEnumName(TypeInfo: PTypeInfo; Value: Integer): string;
怎么用自己看帮助
TM=(one,two,three,four,five,six);
TS = set of TM;procedure TForm1.Button1Click(Sender: TObject);
var
T: TM;
S: TS;
begin
S := [one,two,three];
for T := Low(T) to High(T) do
if T in S then
Edit1.Text:=GetEnumName(TypeInfo(TM), Ord(T));
end;
type
TM=(one,two,three);procedure TForm1.Button1Click(Sender: TObject);
var
T: TM;
begin
T:=two;
Edit1.Text:=GetEnumName(TypeInfo(TM), Ord(T));//two
end;