用消息实现窗体的 MouseDown 事件
作者:互联网
用消息实现窗体的 MouseDown 事件
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 万一 阅读(3683) 评论(1) 编辑 收藏
标签:end,TForm1,窗体,事件,var,MouseDown,procedure,右键 来源: https://blog.51cto.com/u_14617575/2746777