关于Timage的问题
现在有form1和form2,两个form上面各有一个Timage,我想把form1的Timage的图像复制到form2的Timage的某个位置上,请问如何做到?
[解决办法]
- Delphi(Pascal) code
uses Form1;procedure TForm2.FormShow(Sender: TObject);var frm1 : TForm1;begin frm1 := TForm1.Create(nil);//如果Form1已经创建,则不需要创建frm1 ,也不需要释放 try Self.img2.Picture := frm1.img1.Picture; finally FreeAndNil(frm1); end;end;
[解决办法]
如果 要画到某个位置 则上楼代码改成
- Delphi(Pascal) code
with frm1.img1.Picture do begin Self.img2.Picture.Bitmap.Width := Bitmap.Width + 20; Self.img2.Picture.Bitmap.Height := Bitmap.Height + 20; Self.img2.Picture.Bitmap.Canvas.Draw(20,20,Bitmap); end;