关于Control->Perform(...)
我看到一段delphi代码如下
procedure DoTrans(Canvas : TCanvas; Control : TWinControl);var DC : HDC; SaveIndex : HDC; Position: TPoint;begin if Control.Parent <> nil then begin{$R-} DC := Canvas.Handle; SaveIndex := SaveDC(DC); GetViewportOrgEx(DC, Position); SetViewportOrgEx(DC, Position.X - Control.Left, Position.Y - Control.Top, nil); IntersectClipRect(DC, 0, 0, Control.Parent.ClientWidth, Control.Parent.ClientHeight); Control.Parent.Perform(WM_ERASEBKGND, DC, 0); Control.Parent.Perform(WM_PAINT, DC, 0); RestoreDC(DC, SaveIndex);{$R+} end;end;
int __fastcall Perform(unsigned Msg, int WParam, int LParam);
[解决办法]
强制转换一下类型:
Control->Parent->Perform(WM_ERASEBKGND, (WPARAM)DC, 0);