delphi中关于TRect
- Delphi(Pascal) code
var r:TRect;begin r:=ClientRect; r.TopLeft:=Parent.ScreenToClient(ClientToScreen(r.TopLeft)); r.BottomRight:=Parent.ScreenToClient(ClientToScreen(r.BottomRight)); end;
TRect成员没有TopLeft或者是BottomRight啊,写成C++应该是什么样的呢?
[解决办法]
- C/C++ code
TRect r = ClientRect;TPoint pt;pt.x = r.Left;pt.y = r.Top;pt = Parent->ScreenToClient(ClientToScreen(pt));r.Left = pt.x;r.Top = pt.y;pt.x = r.Right;pt.y = r.Bottom;pt = Parent->ScreenToClient(ClientToScreen(pt));r.Right = pt.x;r.Bottom = pt.y;