Delphi XE2(RAD Studio XE2/Delphi16)Beta 试用体验(3)
来源:互联网 发布:网络寻人启事 编辑:程序博客网 时间:2024/05/16 10:21
Reord类型,看起来变成了Object,也可以写函数,偶的神啊,看看System.Types.pas里面的TRect:
TRect = record private function GetWidth: Integer; procedure SetWidth(const Value: Integer); function GetHeight: Integer; procedure SetHeight(const Value: Integer); function GetSize: TSize; procedure SetSize(const Value: TSize); function GetLocation: TPoint; public constructor Create(const Origin: TPoint); overload; // empty rect at given origin constructor Create(const Origin: TPoint; Width, Height: Integer); overload; // at TPoint of origin with width and height constructor Create(const Left, Top, Right, Bottom: Integer); overload; // at x, y with width and height constructor Create(const P1, P2: TPoint; Normalize: Boolean = False); overload; // with corners specified by p1 and p2 constructor Create(const R: TRect; Normalize: Boolean = False); overload; // operator overloads class operator Equal(const Lhs, Rhs: TRect): Boolean; class operator NotEqual(const Lhs, Rhs: TRect): Boolean; // union of two rectangles class operator Add(const Lhs, Rhs: TRect): TRect; // intersection of two rectangles class operator Multiply(const Lhs, Rhs: TRect): TRect; class function Empty: TRect; inline; static; //utility methods //makes sure TopLeft is above and to the left of BottomRight procedure NormalizeRect; //returns true if left = right or top = bottom function IsEmpty: Boolean; //returns true if the point is inside the rect function Contains(const Pt: TPoint): Boolean; overload; // returns true if the rect encloses R completely function Contains(const R: TRect): Boolean; overload; // returns true if any part of the rect covers R function IntersectsWith(const R: TRect): Boolean; // computes an intersection of R1 and R2 class function Intersect(const R1: TRect; const R2: TRect): TRect; overload; static; // replaces current rectangle with its intersection with R procedure Intersect(const R: TRect); overload; // computes a union of R1 and R2 class function Union(const R1: TRect; const R2: TRect): TRect; overload; static; // replaces current rectangle with its union with R procedure Union(const R: TRect); overload; // creates a minimal rectangle that contains all points from array Points class function Union(const Points: Array of TPoint): TRect; overload; static; // offsets the rectangle origin relative to current position procedure Offset(const DX, DY: Integer); overload; procedure Offset(const Point: TPoint); overload; // sets new origin procedure SetLocation(const X, Y: Integer); overload; procedure SetLocation(const Point: TPoint); overload; // inflate by DX and DY procedure Inflate(const DX, DY: Integer); overload; // inflate in all directions procedure Inflate(const DL, DT, DR, DB: Integer); overload; //returns the center point of the rectangle; function CenterPoint: TPoint; function SplitRect(SplitType: TSplitRectType; Size: Integer): TRect; overload; function SplitRect(SplitType: TSplitRectType; Percent: Double): TRect; overload; // changing the width is always relative to Left; property Width: Integer read GetWidth write SetWidth; // changing the Height is always relative to Top property Height: Integer read GetHeight write SetHeight; property Size: TSize read GetSize write SetSize; property Location: TPoint read GetLocation write SetLocation; case Integer of 0: (Left, Top, Right, Bottom: Longint); 1: (TopLeft, BottomRight: TPoint); end;
在对Record的访问上,如:
P:PPoint;
X:integer;
原来X:=P.X;可以,X:=P^.X;也可以(不太符合Pascal严谨的风格),现在也可以。但是其它地方有点变化:
PPointerList = ^TPointerList;
TPointerList = array of Pointer;
var
ASortList: PPointerList;
P, T: Pointer;
P := ASortList[1]; //这样写不行,必须改为P:=ASortList^[1];
- Delphi XE2(RAD Studio XE2/Delphi16)Beta 试用体验(3)
- Delphi XE2(RAD Studio XE2/Delphi16)Beta 试用体验(1)
- Delphi XE2(RAD Studio XE2/Delphi16)Beta 试用体验(2)
- RAD Studio XE2试用体验(1)
- RAD Studio XE2上市啦?
- Delphi XE2,C++ Builder XE2,RAD Studio XE2 v16.0.4504.48759(With Update 4) 官方下载激活
- RAD Studio XE2全球发布会(北京、深圳)圆满结束
- RAD Studio XE2 –mac开发图解
- Embarcadero RAD Studio XE2 Available Downloads
- 英巴卡迪诺发布新版RAD Studio XE2
- Delphi XE2
- 今天安装了一下Delphi的最新版Embarcadero.RAD.Studio.XE2,感觉很不错
- RAD Studio XE2 官方 ISO 下载地址 (With Update1)
- 一连31天,RAD Studio XE2视频教程12月巨献
- RAD Studio XE2/XE3 官方 ISO 下载地址
- 英巴卡迪诺通过新版XE2 RAD Studio,Delphi和C++Builder的发布,变革商业应用程序的开发
- 〖DELPHI〗RAD Studio 2010/XE/XE2/XE3/XE4 官方 ISO 下载地址 (2013-08-28整理)
- Delphi XE2 新功能试用:ZIP压缩文件的操作
- 传递未知个数的同类型参数
- 显示器原理及接口&&显示器BIOS编程II(接口部分) 暂缺
- ims 客户端
- rpmbuild
- android BitmapFactory的OutOfMemoryError: bitmap size exceeds VM budget解决方案
- Delphi XE2(RAD Studio XE2/Delphi16)Beta 试用体验(3)
- Java IO中的mark和reset方法
- android开发环境
- 通过Application统计网站访问人数和在线人数
- pragma+预处理指令详解
- tomcat 配置
- 得到公司代码记账日期的会计年度和会计期间
- [OpenJudge]胡
- ps命令常用用法