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

📄 propedit.pas

📁 类似Delphi Ide的对象查看器 可以在RUNTIME时使用
💻 PAS
字号:
unit PropEdit;

interface

uses Classes, Graphics, PropList, Dialogs;

type

  TPropertyEditor = class
  private
    FProp: TProperty;
  public
    constructor Create(AProp: TProperty); virtual;
    function Execute: Boolean; virtual; abstract;
    property Prop: TProperty read FProp;
  end;

  TPropertyEditorClass = class of TPropertyEditor;

  TFontPropertyEditor = class(TPropertyEditor)
  public
    function Execute: Boolean; override;
  end;

  TColorPropertyEditor = class(TPropertyEditor)
  public
    function Execute: Boolean; override;
  end;

implementation

constructor TPropertyEditor.Create(AProp: TProperty);
begin
  inherited Create;
  FProp:=AProp;
end;

function TFontPropertyEditor.Execute: Boolean;
begin
  with TFontDialog.Create(nil) do
  try
    Font.Assign(TFont(Prop.AsObject));
    Result:=Execute;
    if Result then TFont(Prop.AsObject).Assign(Font);
  finally
    Free;
  end;
end;

function TColorPropertyEditor.Execute: Boolean;
begin
  with TColorDialog.Create(nil) do
  try
    Color:=Prop.AsInteger;
    Result:=Execute;
    if Result then Prop.AsInteger:=Color;
  finally
    Free;
  end;
end;

end.

⌨️ 快捷键说明

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