rect的定义问题(40分)

  • 主题发起人 主题发起人 fl0603
  • 开始时间 开始时间
F

fl0603

Unregistered / Unconfirmed
GUEST, unregistred user!
有这样一个程序
变量声明
var
Form1: TForm1;
bitmap:tbitmap;
i,numm:integer;
rect1,rect2,rect3:trect;
bitmap加载图象后,已画在了form1的画布的正中,然后定义了两个矩形
with rect1 do
begin
left:=0;
top:=i;
right:=bitmap.width;
bottom:=i+1;
end;
with rect2 do
begin
left:=0;
top:=(form1.Height div 2)-i-1;
right:=bitmap.Width;
bottom:=(form1.height div 2)-i;
end;
然后执行复制语句canvas.CopyRect(rect2,bitmap.Canvas,rect1); 把图象复制到form1的画布上
结果是把处于form1正中的rect1被复制到form1最左边的正中
请问在定义矩形rect1时,为什么就是以bitmap的画布为坐标系,而rect2是以form1画布为坐标系
 
rect2 是目标的矩形,这里是Form1 因为你用的是 From1的 canvas来画.
rect1 是源的矩形区域,这里当然是第二个参的属主 bitmap
 
接受答案了.
 
后退
顶部