Posted on 2012-12-24 14:20
盛勝 閱讀(293)
評論(0) 編輯 收藏 引用
RECT的特點
----RECT既是個特別的數據結構,又是個函數,他的作用就是定義一個矩形區域對象,而作為函數使用時他能用兩個屬性(Tpiont型)指明區域范圍,同時也可分解成四個單一的變量類型(Integer型),即:
topleft:左上角坐標(Tpiont型變量);
bottomright:右下角坐標(Tpiont型變量);
topleft.x或left:左上角橫坐標;
topleft.y或top:左上角縱坐標;
bottomright.x或right:右下角橫坐標;
bottomright.y或bottom:右下角縱坐標。
----例如,下面三種方法定義一個相同的RECT變量:
Rect(10,10,110,210);
topleft:=Piont(10,10);
bottomright:=Point(110,210);
left:=10;top:=10;right:=110;Bottom:=210;
----下面的代碼在Form1窗體上定義一個RECT矩形并用紅色填充:
var
NewRect: TRect;
begin
NewRect := Rect(20, 30, 50, 90);
Form1.Canvas.Brush.Color := clRed;
Form1.Canvas.FillRect(NewRect);
end;