13,825
社区成员
发帖
与我相关
我的任务
分享
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
this->WindowProc = Proc;
}
//加入这些代码,所有非TWinControl控件才能响应鼠标
void __fastcall TForm1::Proc(TMessage & message)
{
TPoint pt;
pt.x = message.LParamLo;
pt.y = message.LParamHi;
if(message.Msg == WM_LBUTTONDOWN || message.Msg == WM_LBUTTONUP)
{
TControl* control= ControlAtPos(pt, false);
if(control)
{
message.Result = control->Perform(message.Msg, message.WParam, message.LParam);
}
}
this->Dispatch(&message);
}