5,392
社区成员
发帖
与我相关
我的任务
分享
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
type
TypeInfo = (tiNormal, tiMinimized, tiMaximized);
PTypeInfo = ^TypeInfo;
const
TYPE_INFO_NAME: array[0..2] of string = ('Normal', 'Minimized', 'Maximized');
function GetTypeInfoByName(sName: string): TypeInfo;
var
i: integer;
begin
Result := tiNormal;
for i := Low(TYPE_INFO_NAME) to High(TYPE_INFO_NAME) do
if sName = TYPE_INFO_NAME[i] then
begin
Result := TypeInfo(i);
Break;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ti: TypeInfo;
begin
ti := GetTypeInfoByName('Minimized');
ShowMessage(TYPE_INFO_NAME[Byte(ti)]);
end;
end.