标题栏的右击

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
拦截WM_NCRBUTTONDOWN;即可!
如果只想拦截在form右边三个按钮上的右击事件,则应该拦截WM_NCRBUTTONUP!
private
procedure WMNCRBUTTONDOWN(var msg: TMessage); message WM_NCRBUTTONDOWN;
procedure WMNCLBUTTONDOWN(var msg: TMessage); message WM_NCLBUTTONDOWN;
procedure WMNCLBUTTONDBLCLK(var msg: TMessage); message WM_NCLBUTTONDBLCLK;
end;
 
 
implementation
 
procedure TForm1.WMNCRBUTTONDOWN(var msg: TMessage);
begin
if msg.wParam = HTCAPTION then Caption := 'Right Click!';
// Message.Result := 0; {to ignore the message}
inherited;
end;
procedure TForm1.WMNCLBUTTONDOWN(var msg: TMessage);
begin
if msg.wParam = HTCAPTION then Caption := 'Left Click!';
// Message.Result := 0; {to ignore the message}
inherited;
end;
procedure TForm1.WMNCLBUTTONDBLCLK(var msg: TMessage);
begin
if msg.wParam = HTCAPTION then Caption := 'Double Click!';
// Message.Result := 0; {to ignore the message}
inherited;
end;
*********************************
Simple method from Nail
...
interface
TForm1 = class(TForm)
...
private
procedure WMNCHitTest(var message:TWMNCHitTest); message WM_NCHITTEST;
...
implementation
...
procedure TForm1.WMNCHitTest(var message:TWMNChitTest);
begin
if message.result = HT_CAPTION then
begin
...
end;
end;
...
 

Similar threads

I
回复
0
查看
511
import
I
I
回复
0
查看
480
import
I
I
回复
0
查看
515
import
I
I
回复
0
查看
529
import
I
I
回复
0
查看
446
import
I
后退
顶部