⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uregister.pas

📁 一个模拟Delphi的快速开发环境RAD
💻 PAS
字号:
unit URegister;
// 捞 蜡聪飘绰 橇肺弊伐俊辑 加己 祈笼扁甫 荤侩且 荐 乐档废 加己 祈笼扁甫 殿废茄促.
// 加己 祈笼扁甫 殿废窍瘤 臼栏搁 胆颇捞绰 扁夯利牢 加己 祈笼扁甫 捞侩窍骨肺
// TFontProperty客 鞍篮 促弗 加己 祈笼扁甫 荤侩且 荐 绝促.
// 捞 蜡聪飘绰 Object Inspector啊 积己瞪 锭 , Register 橇肺矫历甫 捞侩秦
// 加己 祈笼扁甫 殿废茄促.

interface

uses
   Classes,DsgnIntf,Graphics,Controls,FileCtrl,uComponentList,Forms;

type
   // TStrings 鸥涝狼 加己阑 祈笼窍扁 困茄 加己 祈笼扁
   THD_StringListProperty = class(TClassProperty)
   public
      procedure Edit;override;
      function GetAttributes: TPropertyAttributes;override;
   end;

   THD_PictureProperty = class(TClassProperty)
   public
      procedure Edit;override;
      function GetAttributes: TPropertyAttributes;override;
   end;


  THD_MenuItemProperty = class(TClassProperty)
   public
      procedure Edit;override;
      function GetAttributes: TPropertyAttributes;override;
   end;

procedure Register;

implementation

uses UStrings,upicedit,Menus,Dialogs,umenuitem;

procedure Register;
begin
    RegisterPropertyEditor(TypeInfo(TFont),nil,'',TFontProperty);
    RegisterPropertyEditor(TypeInfo(TColor),nil,'',TColorProperty);
    RegisterPropertyEditor(TypeInfo(TCursor),nil,'',TCursorProperty);
    RegisterPropertyEditor(TypeInfo(TStrings),nil,'',THD_StringListProperty);
    RegisterPropertyEditor(TypeInfo(TPicture),nil,'',THD_PictureProperty);
    RegisterPropertyEditor(TypeInfo(TMenuItem),nil,'TMenuItem',THD_MenuItemProperty);
end;

procedure THD_StringListProperty.Edit;
begin
   with TStringsForm.Create(Application) do
   begin
       try
          Memo1.Lines:=TStrings(GetOrdValue);
          if ShowModal=mrOK then  SetOrdValue(Longint(Memo1.Lines));
       finally
          Free;
       end;
   end;
end;

function THD_StringListProperty.GetAttributes:TPropertyAttributes;
begin
   Result:=inherited GetAttributes + [paDialog];
end;

procedure THD_PictureProperty.Edit;
begin
   with TPictureEdit.Create(Application) do
   begin
       try
          Image1.Picture:=TPicture(GetOrdValue);
          if ShowModal=mrOK then  SetOrdValue(Longint(Image1.Picture));
       finally
          Free;
       end;
   end;
end;

function THD_PictureProperty.GetAttributes:TPropertyAttributes;
begin
   Result:=inherited GetAttributes + [paDialog];
end;

procedure THD_MenuItemProperty.Edit;
var
  Menuitem:TMenuItem;
begin
   with TMenuItemForm.Create(Application) do
   begin
       try
         // MainMenu1.Items:= TMenuItem(GetOrdValue);
          MenuItem:= TMenuItem.Create(MainMenu1);
          MenuItem.Caption:='test';
          MainMenu1.Items.Add(MenuItem);
          if ShowModal=mrOK then  ;
       finally
          Free;
       end;
   end;
end;

function THD_MenuItemProperty.GetAttributes:TPropertyAttributes;
begin
   Result:=inherited GetAttributes + [paDialog];
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -