拦截WM_NCHITTEST消息进行处理后.图片相关控件(如TImage)的事件(如OnClick)失效了.希望达人帮忙...
procedure FormMoveAsHit(var Msg: TWMNCHitTest); message WM_NCHITTEST;
procedure TDefaultForm.FormMoveAsHit(var Msg: TWMNCHitTest);
const
CanMoveRect = 3;
var
MousePoint: TPoint;
begin
inherited;
MousePoint := ScreenToClient(Point(Msg.XPos, Msg.YPos));
if PtInRect(Rect(0, 0, CanMoveRect, CanMoveRect), MousePoint) then
Msg.Result := HTTOPLEFT
else if PtInRect(Rect(Width - CanMoveRect, Height - CanMoveRect, Width, Height), MousePoint) then
Msg.Result := HTBOTTOMRIGHT
else if PtInRect(Rect(Width - CanMoveRect, 0, Width, CanMoveRect), MousePoint) then
Msg.Result := HTTOPRIGHT
else if PtInRect(Rect(0, Height - CanMoveRect, CanMoveRect, Height), MousePoint) then
Msg.Result := HTBOTTOMLEFT
else if PtInRect(Rect(CanMoveRect, 0, Width - CanMoveRect, CanMoveRect), MousePoint) then
Msg.Result := HTTOP
else if PtInRect(Rect(0, CanMoveRect, CanMoveRect, Height - CanMoveRect), MousePoint) then
Msg.Result := HTLEFT
else if PtInRect(Rect(Width - CanMoveRect, CanMoveRect, Width, Height - CanMoveRect), MousePoint) then
Msg.Result := HTRIGHT
else if PtInRect(Rect(CanMoveRect, Height - CanMoveRect, Width - CanMoveRect, Height), MousePoint) then
Msg.Result := HTBOTTOM
else if PtInRect(Image_TopMid.ClientRect, MousePoint) then
Msg.Result := HTCAPTION
else if PtInRect(BtnMinimize.ClientRect, MousePoint) then
Msg.Result := HTMINBUTTON
else if PtInRect(BtnMaximize.ClientRect, MousePoint) then
Msg.Result := HTMAXBUTTON
else if PtInRect(BtnClose.ClientRect, MousePoint) then
Msg.Result := HTCLIENT;
end;
procedure FormMoveAsHit(var Msg: TWMNCHitTest); message WM_NCHITTEST;
procedure TDefaultForm.FormMoveAsHit(var Msg: TWMNCHitTest);
const
CanMoveRect = 3;
var
MousePoint: TPoint;
begin
inherited;
MousePoint := ScreenToClient(Point(Msg.XPos, Msg.YPos));
if PtInRect(Rect(0, 0, CanMoveRect, CanMoveRect), MousePoint) then
Msg.Result := HTTOPLEFT
else if PtInRect(Rect(Width - CanMoveRect, Height - CanMoveRect, Width, Height), MousePoint) then
Msg.Result := HTBOTTOMRIGHT
else if PtInRect(Rect(Width - CanMoveRect, 0, Width, CanMoveRect), MousePoint) then
Msg.Result := HTTOPRIGHT
else if PtInRect(Rect(0, Height - CanMoveRect, CanMoveRect, Height), MousePoint) then
Msg.Result := HTBOTTOMLEFT
else if PtInRect(Rect(CanMoveRect, 0, Width - CanMoveRect, CanMoveRect), MousePoint) then
Msg.Result := HTTOP
else if PtInRect(Rect(0, CanMoveRect, CanMoveRect, Height - CanMoveRect), MousePoint) then
Msg.Result := HTLEFT
else if PtInRect(Rect(Width - CanMoveRect, CanMoveRect, Width, Height - CanMoveRect), MousePoint) then
Msg.Result := HTRIGHT
else if PtInRect(Rect(CanMoveRect, Height - CanMoveRect, Width - CanMoveRect, Height), MousePoint) then
Msg.Result := HTBOTTOM
else if PtInRect(Image_TopMid.ClientRect, MousePoint) then
Msg.Result := HTCAPTION
else if PtInRect(BtnMinimize.ClientRect, MousePoint) then
Msg.Result := HTMINBUTTON
else if PtInRect(BtnMaximize.ClientRect, MousePoint) then
Msg.Result := HTMAXBUTTON
else if PtInRect(BtnClose.ClientRect, MousePoint) then
Msg.Result := HTCLIENT;
end;
解决方案 »
- 问个流读写问题
- WebBrowser去掉菜单怎么写
- 将dbgrid中的数据导入到excel中后,怎样使它居中?怎样设置页面整齐,打印的时候直接打印就可以,而不需要调整?
- 为什么我在关闭这个窗体后 再次打开运行的时候 曲线就显示不出来呢 ????顶者有份!!!!!!
- 多层分布式开发中数据更新所遇到的问题。
- 如何利用一个TQUERY控件的SQL语句
- 急~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 求助高手!!我的Delphi程序有个地方运行不了,求高手帮我调试!!
- 那里有delphi的安装程序下载?(无内容)
- 请教delphi使用控件Chromium如何实现全网页截屏?
- 内存泄漏之五 史无前例500分大放送
- 寻找控件,不知道哪位看见过呢?
是图片相关控件(如TImage)的所有事件都失效了...