随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    procedure WMMouseDown(var msg: TMessage); message WM_LBUTTONDOWN;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

//运行后在窗体上点击左键会激活:
procedure TForm1.WMMouseDown(var msg: TMessage);
begin
  ShowMessage('WM_LBUTTONDOWN');
end;

//运行后在窗体上点击右键会激活:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ShowMessage('这是Delphi事件');  //被阻挡,但没有阻挡右键
end;

end.
posted on 2007-12-08 19:00  万一  阅读(...)  评论(...编辑  收藏