📄 pename.pas
字号:
unit PeName;
interface
uses
SysUtils, WinTypes, WinProcs, Messages,
Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DsgnIntf;
type
TNameProperty = class (TStringProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
procedure Register;
implementation
uses
PeFName;
{property editor methods}
function TNameProperty.GetAttributes:
TPropertyAttributes;
begin
Result := [paDialog];
end;
procedure TNameProperty.Edit;
var
PeForm: TNameForm;
TheComponent: TComponent;
TheForm: TForm;
I: Integer;
begin
PeForm := TNameForm.Create (Application);
try
PeForm.Edit1.Text := GetValue;
// fill the listboxes
TheComponent := GetComponent (0) as TComponent;
if TheComponent is TForm then
TheForm := TForm (TheComponent)
else
TheForm := (TheComponent.Owner) as TForm;
for I := 0 to TheForm.ComponentCount - 1 do
begin
PeForm.ListAll.Items.Add (TheForm.Components[I].Name);
if TheForm.Components[I] is TheComponent.ClassType then
PeForm.ListSame.Items.Add (TheForm.Components[I].Name);
end;
if PeForm.ShowModal = mrOK then
SetValue (PeForm.Edit1.Text);
finally
PeForm.Free;
end;
end;
procedure Register;
begin
RegisterPropertyEditor (TypeInfo(TComponentName),
TComponent, 'Name', TNameProperty);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -