S Sword_Sharp Unregistered / Unconfirmed GUEST, unregistred user! 2001-10-04 #1 在Delphi中当鼠标点击窗体时让系统认为被点的是标题兰?
卷 卷起千堆雪tyn Unregistered / Unconfirmed GUEST, unregistred user! 2001-10-04 #2 private ; ; { Private declarations } ; ; procedure WMNCHITTEST(VAR M:TWMNCHITTEST); message wm_nchittest; implementation {$R *.DFM} procedure TForm1.WMNCHITTEST(var M:TWMNCHITTEST); begin ; inherited; ; if M.Result =htClient then ; M.Result :=htCaption; end;
private ; ; { Private declarations } ; ; procedure WMNCHITTEST(VAR M:TWMNCHITTEST); message wm_nchittest; implementation {$R *.DFM} procedure TForm1.WMNCHITTEST(var M:TWMNCHITTEST); begin ; inherited; ; if M.Result =htClient then ; M.Result :=htCaption; end;
Q QuickSilver Unregistered / Unconfirmed GUEST, unregistred user! 2001-10-04 #3 private ; procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest; ; ;... ; end; procedure TForm1.WMNCHitTest(var M: TWMNCHitTest); ; ; begin ; ; ;inherited; ; ; ;if M.Result = htClient then M.Result := htCaption; ; ; end; 或载extrapack控件,里面有epmoveform控件可达到你要的效果
private ; procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest; ; ;... ; end; procedure TForm1.WMNCHitTest(var M: TWMNCHitTest); ; ; begin ; ; ;inherited; ; ; ;if M.Result = htClient then M.Result := htCaption; ; ; end; 或载extrapack控件,里面有epmoveform控件可达到你要的效果
S Sword_Sharp Unregistered / Unconfirmed GUEST, unregistred user! 2001-10-04 #4 卷起千堆雪tyn, : 谢谢你!可以讲讲原理吗?我是个菜鸟;
卷 卷起千堆雪tyn Unregistered / Unconfirmed GUEST, unregistred user! 2001-10-04 #5 当你点击窗体时,发送wm_nchittest消息,如果是点在客户区,就误以为是点击在标题栏。 建议多看看WINDOWS的消息处理机制。OK?
S Sword_Sharp Unregistered / Unconfirmed GUEST, unregistred user! 2001-10-04 #7 这样为何不可以? procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; ; Shift: TShiftState; X, Y: Integer); begin ; SendMessage(Handle, WM_NCHITTEST, 0, 2570); end;
这样为何不可以? procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; ; Shift: TShiftState; X, Y: Integer); begin ; SendMessage(Handle, WM_NCHITTEST, 0, 2570); end;
Q QuickSilver Unregistered / Unconfirmed GUEST, unregistred user! 2001-10-04 #8 这样是不可以的 你对卷起千堆雪tyn说的还不太明白 是要去改变WM_NCHITTEST返回的结果,而不仅仅是调用WM_NCHITTEST