IsRectEmpty: 判断矩形是否为空;
所谓矩形为空就是矩形是无区域的, 或者说是 Right <= Left 或 Bottom <= Top 情形下的矩形.
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var R: TRect; buf: array[Byte] of Char; begin R := Rect(10,20,-30,-40); ShowMessage(BoolToStr(IsRectEmpty(R), True)); {True; 是空矩形} R := Rect(10,20,30,40); ShowMessage(BoolToStr(IsRectEmpty(R), True)); {False} wvsprintf(buf, 'L:%d, T:%d, R:%d, B:%d', @R); ShowMessage(buf); {L:10, T:20, R:30, B:40} SetRectEmpty(R); ShowMessage(BoolToStr(IsRectEmpty(R), True)); {True} wvsprintf(buf, 'L:%d, T:%d, R:%d, B:%d', @R); ShowMessage(buf); {L:0, T:0, R:0, B:0} end; end.关于 wvsprintf 函数请参见: http://www.cnblogs.com/del/archive/2008/04/18/1159045.html