📄 strform.pas
字号:
unit StrForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
ButtonGet: TButton;
EditProperty: TEdit;
Label1: TLabel;
Bevel1: TBevel;
ButtonTrial: TButton;
Label2: TLabel;
LabelResult: TLabel;
ButtonSet: TButton;
Label3: TLabel;
EditValue: TEdit;
procedure ButtonGetClick(Sender: TObject);
procedure ButtonSetClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
uses
TypInfo;
procedure TForm1.ButtonGetClick(Sender: TObject);
var
PropInfo: PPropInfo;
begin
if not Assigned (ButtonTrial) then
ShowMessage ('The button has been renamed')
else
begin
PropInfo := GetPropInfo (
ButtonTrial.ClassInfo, EditProperty.Text);
if PropInfo <> nil then
if PropInfo^.PropType^.Kind =
tkLString then
LabelResult.Caption :=
GetStrProp (ButtonTrial, PropInfo)
else
ShowMessage ('Not a string property')
else
ShowMessage ('Property doesn''t exist');
end;
end;
procedure TForm1.ButtonSetClick(Sender: TObject);
var
PropInfo: PPropInfo;
begin
if not Assigned (ButtonTrial) then
ShowMessage ('The button has been renamed')
else
begin
PropInfo := GetPropInfo (
ButtonTrial.ClassInfo, EditProperty.Text);
if PropInfo <> nil then
if PropInfo^.PropType^.Kind =
tkLString then
SetStrProp (ButtonTrial, PropInfo, EditValue.Text)
else
ShowMessage ('Not a string property')
else
ShowMessage ('Property doesn''t exist');
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -