重载CreateParams实现无标题栏的窗体
重载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;
}