读书人

delphi中关于TRect解决方法

发布时间: 2012-09-20 09:36:50 作者: rapoo

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; 

读书人网 >C++ Builder

热点推荐