重新捕获WM_NcHitTest消息! .... public procedure WmNcHitTest(var Msg:TMessage);message WM_NCHITTEST; .... procedure TForm1.WmNcHitTest(var Msg:TMessage);message WM_NCHITTEST; begin end;
过程定义: 捕捉上FORM的WM_NCHITTEST消息 public procedure CreateParams(Var Params: TCreateParams); Override; procedure DragForm(Var Msg: TWMNCHITTEST);Message WH_NCHITTEST;procedure TForm1.CreateParams(Var Params: TCreateParams); begin //设置Form的风格 Inherited CreateParams(Params); Params.Style := WS_THICKFRAME or WS_POPUP or WS_BORDER; end; procedure TForm1.DragForm(Var Msg: TWMNCHITTEST); begin //使鼠标可以拖动Form本身移动 Msg.Result := HTCAPTION; end;
procedure TForm1.WmNcHitTest(var Msg:TMessage);message WM_NCHITTEST; begin if Result=htCation then //SomeCodeImplementTheFunctionYouWant; end;
各位讲的是检测鼠标在WM_NCHITTEST区的事件.不是我想要的啊。 写个伪代码表达我的问题 : if 鼠标在 标题栏上按下 then showmessage('you click htcaption!').
public procedure WmNcHitTest(var Msg:TMessage);message WM_NCHITTEST;procedure TForm1.WmNcHitTest(var Msg:TMessage); begin inherited; if Result=htCation then showmessage('you click htcaption!') end;
....
public
procedure WmNcHitTest(var Msg:TMessage);message WM_NCHITTEST;
....
procedure TForm1.WmNcHitTest(var Msg:TMessage);message WM_NCHITTEST;
begin
end;
捕捉上FORM的WM_NCHITTEST消息
public
procedure CreateParams(Var Params: TCreateParams); Override;
procedure DragForm(Var Msg: TWMNCHITTEST);Message WH_NCHITTEST;procedure TForm1.CreateParams(Var Params: TCreateParams);
begin
//设置Form的风格
Inherited CreateParams(Params);
Params.Style := WS_THICKFRAME or WS_POPUP or WS_BORDER;
end;
procedure TForm1.DragForm(Var Msg: TWMNCHITTEST);
begin
//使鼠标可以拖动Form本身移动
Msg.Result := HTCAPTION;
end;
begin
if Result=htCation then
//SomeCodeImplementTheFunctionYouWant;
end;
写个伪代码表达我的问题 : if 鼠标在 标题栏上按下 then showmessage('you click htcaption!').
procedure WmNcHitTest(var Msg:TMessage);message WM_NCHITTEST;procedure TForm1.WmNcHitTest(var Msg:TMessage);
begin
inherited;
if Result=htCation then showmessage('you click htcaption!')
end;