没有双击事件实现的两种形式

一。mouseDown事件下判断

 if (ssDouble in Shift) and (ssLeft in Shift) then
    begin
        ShowMessage('aa');
    end;

二。启动窗口创建完毕 Application.OnMessage := onAppMessage;

消息处理详解

Vcl.Forms.TApplication.OnMessage
TMessageEvent = procedure (var Msg: TMsg; var Handled: Boolean) of object;

TMsg = tagMSG ;

tagMSG = record
hwnd: HWND;
message: UINT;
wParam: WPARAM;
lParam: LPARAM;
time: DWORD;
pt: TPoint;
end;
程序在接受到一条窗口消息的时候发生。
OnMessage 用来捕获程序中所有被投递到窗口的消息。
OnMessage 只有在窗口接收到一个窗口消息的时候发生。
一个OnMessage事件处理函数允许一个程序

如果未指定TMsg的hwnd,程序将响应窗口内(包含窗口)所有的事件

当handled=True时,程序假定所有窗口消息已被全部处理,并终止了所有并发消息
这里我们handled一般写False.让其他消息得以处理。

procedure TForm1.onAppMessage(var msg: tagMSG; var handled: Boolean);
begin
    //
    if (msg.message = WM_LBUTTONDBLCLK )and (msg.hwnd = PageControl1.Handle) then
    //此处表示处理 PageControl1控件被双击的事件
    begin
    
        ShowMessage('bb');
    end;
    handled := False;
    
end;
原文地址:https://www.cnblogs.com/cause/p/3664059.html