hexeditreg.pas

来自「=== === === MiniHex 1.61 源程序说明 =」· PAS 代码 · 共 67 行

PAS
67
字号
unit HexEditReg;

{$I Ver.inc}

interface

uses
  Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, Graphics;

procedure Register;

implementation

uses
  HexEdit,
{$IFDEF VER_COMPILER_6_UP}
  DesignIntf, DesignEditors;
{$ELSE}
  DsgnIntf;
{$ENDIF}

type

{ Property Editor }

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

procedure Register;
begin
  RegisterComponents('DayDream', [THexEdit]);
  RegisterPropertyEditor(TypeInfo(TFont), THexEdit, 'Font', THexEditFontProperty);
end;

{ THexEditFontProperty }

function THexEditFontProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadOnly];
end;

procedure THexEditFontProperty.Edit;
var
  FontDialog: TFontDialog;
  AHexEdit: THexEdit;
begin
  AHexEdit := GetComponent(0) as THexEdit;
  FontDialog := TFontDialog.Create(Application);
  try
    FontDialog.Font := AHexEdit.Font;
    FontDialog.Options := FontDialog.Options + [fdFixedPitchOnly];
    if FontDialog.Execute then
    begin
      AHexEdit.Font := FontDialog.Font;
      AHexEdit.Invalidate;
      Modified;
    end;
  finally
    FontDialog.Free;
  end;
end;

end.

⌨️ 快捷键说明

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