重载TForm类的CreateParams(TCreateParams& Params)方法。
void __fastcall CreateParams(TCreateParams& Params)
{
Params.Style&=WS_CAPTION;
TForm::CreateParams(Params);
}
截取Windows的WM_NCHITTEST消息
在头文件中加入
private:
void __fastcall WMNChitTest(TMessage& Msg);
protected:
BEGIN_MESSAGE_MAP
VCL_MESSAGE_HANDLER(WM_NCHITTEST,TMessage,WMNChitTest)
END_MESSAGE_MAP(TForm)
在主文件中加入
void __fastcall WMNChitTest(TMessage& Msg)
{
if(GetAsyncKeyState(VK_LBUTTON)<0)
Msg.Result=HTCAPTION;
else
Msg.Result=HTCLIENT;
}
时间: 2024-12-03 16:02:45