新闻资讯
看你所看,想你所想

TRect

TR务毫附优财浓兵ect是Delphi语言里面的一个数据类型,形同c++里面的CRe顶早ct类,定义了一个矩形,包括top、bottom、left、right、w烧斯idth、height。

  • 外文名称 TRect
  • 解释 Delphi 语言里面的一个数据类型
  • 包括 top,bottom,left,right等
  • 补充 重载了运算符

也鲜厂而哥状里松跑析叶

  当然,重载了运算符。

TRect类型

  TRect defines a rectangle.

  Unit

  来自Types

  Delphi syntax:

  type

  TRect = packed record

  case Integer of

  0: (Left, Top, Right, Bottom: Integer);

  1: (TopLeft, BottomRight: TPoi360百科nt);

  end述段;

  C++ syntax:

  struct TRect

  {

  TRect() {}

  TRect(const TPoint& TL, co前某民蒸nst TPoint& BR) { left=T甲补定刘限衡L.x; top=T验依破在底触观L.y; right=BR.x; bottom=BR.y; }

  TRect(int l, int t, int r, i织机属病功nt b) { left=l; top=t; right=r; bottom=b; }

  TRect(RECT& r)

  {

  left = r.left;

  top = r.top;

  rig笔力沿良稳的温愿派ht = r.right;

  宪也bottom = r.botto板晶承规销原封听m;

  }

  int Width () const { return right - left; }

  int Heig什投ht() const { return bottom - top ; }

  bool operator ==(co先下nst TRect& rc) const

  {

  return left == rc.left && top==r银罗预例胜汉c.top &&

  right == rc.right && bottom==rc.bottom;

  }

  bool oper斤队酒造室伯异ator !=(const TRect& rc) const

  { return !(资期rc==*this); }

  __property LONG Left = { read=left, write=left };

  __property LONG Top = { read=top, write=top };

  __property LONG Right = { read=right, write=right };

  __property LONG Bottom = { read=bottom, write=bottom };

  };

  Description

  T载搞食某逐办斗Rect repr化院足进两丰屋想班esents the dimensions of a rectangle. The coordinates are specifi阳预苗转苗友超ed as either four separate integers representing the left, top, right, and bottom sides, or as two points representing the locations of the top left and bottom right corners.

  Typically, TRect values represent pixel locations, where the origin of the pixel coordinate system is in the top left corner of the screen (screen coordinates) or the top left corner of a control抯 client area (client coordinates). When a TRect value represents a rectangle on the screen, by convention the top and left edges are considered inside the rectangle and the bottom and right edges are considered outside the rectangle. This convention allows the width of the rectangle to be Right - Left and the height to be Bottom - Top.

转载请注明出处安可林文章网 » TRect

相关推荐

    声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:fendou3451@163.com