frmmain.~pas

来自「这是不可多得的源代码」· ~PAS 代码 · 共 42 行

~PAS
42
字号
unit frmMain;

interface

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

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
  procedure AddMouseMessage(sButtonName:String; ButtonX, ButtonY: Integer);
  begin
    ListBox1.Items.Add(Format('%s X:%d,Y:%d',[sButtonName,ButtonX, ButtonY]));
  end;
begin
  case Button of    //
    mbLeft:  AddMouseMessage('鼠标左键',X,Y);
    mbRight: AddMouseMessage('鼠标右键',X,Y);
    mbMiddle: AddMouseMessage('鼠标中键',X,Y);
  end;    // case
end;

end.

⌨️ 快捷键说明

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