标题栏的右击

  • 主题发起人 主题发起人 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
查看
522
import
I
I
回复
0
查看
492
import
I
I
回复
0
查看
524
import
I
I
回复
0
查看
540
import
I
I
回复
0
查看
456
import
I
后退
顶部