通常我们都是用拦截WM_NCHITTEST消息来移动无标题的窗口,介绍这个用法的文章很多,可是用WM_NCHITTEST同样能禁止窗口移动.
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMNCHITTEST(var Msg: TWMNCHITTEST); message WM_NCHITTEST;
procedure TForm1.WMNCHITTEST(var Msg: TWMNCHITTEST);
begin
inherited;
if Msg.Result = HTCAPTION then
Msg.Result := 0
end;
文章转自:http://www.cnill.com/jibing/lunwen/process/200702/lunwen_50946.shtml
TForm1 = class(TForm)
private
{ Private declarations }
procedure WMNCHITTEST(var Msg: TWMNCHITTEST); message WM_NCHITTEST;
procedure TForm1.WMNCHITTEST(var Msg: TWMNCHITTEST);
begin
inherited;
if Msg.Result = HTCAPTION then
Msg.Result := 0
end;
文章转自:http://www.cnill.com/jibing/lunwen/process/200702/lunwen_50946.shtml