ddhinpub.pas

来自「Delphi高级开发指南是开发程序的好帮手」· PAS 代码 · 共 44 行

PAS
44
字号
unit DdhInpuB;

interface

{$R *.DCR}

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

type
  TDdhInputButton = class(TButton)
  private
    procedure WmChar (var Msg: TWMChar);
      message wm_Char;
  end;

procedure Register;

implementation

procedure TDdhInputButton.WmChar (var Msg: TWMChar);
var
  Temp: String;
begin
  if Char (Msg.CharCode) = #8 then
  begin
    // if backspace, remove last char
    Temp := Caption;
    Delete (Temp, Length (Temp), 1);
    Caption := Temp;
  end
  else
    // add the char
    Caption := Caption + Char (Msg.CharCode);
end;

procedure Register;
begin
  RegisterComponents('DDHB', [TDdhInputButton]);
end;

end.

⌨️ 快捷键说明

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