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

📄 uregister.pas

📁 delphi 写的delphi的程序 Handel is a free, standalone development tool created with Delphi 3 that enable
💻 PAS
字号:
unit URegister;
// 捞 蜡聪飘绰 橇肺弊伐俊辑 加己 祈笼扁甫 荤侩且 荐 乐档废 加己 祈笼扁甫 殿废茄促.
// 加己 祈笼扁甫 殿废窍瘤 臼栏搁 胆颇捞绰 扁夯利牢 加己 祈笼扁甫 捞侩窍骨肺
// TFontProperty客 鞍篮 促弗 加己 祈笼扁甫 荤侩且 荐 绝促.
// 捞 蜡聪飘绰 Object Inspector啊 积己瞪 锭 , Register 橇肺矫历甫 捞侩秦
// 加己 祈笼扁甫 殿废茄促.

interface

uses
   Classes,DsgnIntf,Graphics,Controls,FileCtrl,uComponentList,Forms, Buttons,
   SysUtils,DB;

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

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

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

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

  TYB_DataSetProperty = class(TPropertyEditor)
  private
  public
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
    procedure SetValue(const Value: string); override;
    procedure GetValues(Proc:TgetStrProc); override;
  end;

  TYB_DataSourceProperty = class(TPropertyEditor)
  private
  public
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
    procedure SetValue(const Value: string); override;
    procedure GetValues(Proc:TgetStrProc); 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,'',TYB_StringListProperty);
    RegisterPropertyEditor(TypeInfo(TPicture),nil,'',TYB_PictureProperty);
    RegisterPropertyEditor(TypeInfo(TIcon), nil,'',TYB_GraphicProperty);
    RegisterPropertyEditor(TypeInfo(TBitmap), nil,'',TYB_GraphicProperty);
    RegisterPropertyEditor(TypeInfo(TMenuItem),nil,'TMenuItem',TYB_MenuItemProperty);
    RegisterPropertyEditor(TypeInfo(TDataSet),nil,'',TYB_DataSetProperty);
    RegisterPropertyEditor(TypeInfo(TDataSource),nil,'',TYB_DataSourceProperty);
end;

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

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

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

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

{TYB_GraphicProperty}
procedure TYB_GraphicProperty.Edit;
begin
   with TPictureEdit.Create(nil) do
   begin
       try
          Image1.Picture:= TPicture(GetOrdValue);
          if ShowModal=mrOK then  SetOrdValue(Longint(Image1.Picture.Graphic));
       finally
          Free;
       end;
   end;
end;

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

{TYB_MenuItemProperty}
procedure TYB_MenuItemProperty.Edit;
var
  Menuitem:TMenuItem;
begin
   with TMenuItemForm.Create(nil) do
   begin
       try
          MenuHandle:= GetOrdValue;
          if ShowModal= mrOK then {SetOrdValue(MenuItem.Handle)};
       finally
          Free;
       end;
   end;
end;

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

{TYB_DataSetProperty}
function TYB_DataSetProperty.GetValue: string;
begin
end;

procedure TYB_DataSetProperty.SetValue(const Value: string);
begin
end;

function TYB_DataSetProperty.GetAttributes:TPropertyAttributes;
begin
   Result:=inherited GetAttributes + [paValueList, paSortList];
end;

procedure TYB_DataSetProperty.GetValues(Proc: TGetStrProc);
var
   I:Integer;
begin
    for I:= 0  to Designer.Form.ComponentCount - 1 do
       if (Designer.Form.Components[I] is TDataSet) then
          Proc(Designer.Form.Components[I].Name);
end;

{TYB_DataSourceProperty}
function TYB_DataSourceProperty.GetValue: string;
begin
end;

procedure TYB_DataSourceProperty.SetValue(const Value: string);
begin
end;

function TYB_DataSourceProperty.GetAttributes:TPropertyAttributes;
begin
   Result:=inherited GetAttributes + [paValueList, paSortList];
end;

procedure TYB_DataSourceProperty.GetValues(Proc: TGetStrProc);
var
   I:Integer;
begin
    for I:= 0  to Designer.Form.ComponentCount - 1 do
       if (Designer.Form.Components[I] is TDataSource) then
          Proc(Designer.Form.Components[I].Name);
end;

end.

⌨️ 快捷键说明

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