procedure TForm1.Button1Click(Sender: TObject); begin Image2.Stretch := True; Image2.Picture.Assign(Image1.Picture); end;
就是, 楼上的答对了,但是如果image2很大的话, 显示就不好看了
属性Image2.Stretch := True;
I,J:integer; Row,Col:integer; begin Row:=round(Image2.height/24); Col:=round(Image2.width/24); for I := 0 to Row - 1 do begin for J := 0 to Col - 1 do begin Form1.Image2.Canvas.CopyRect(Rect(J*24,I*24,(J+1)*24, (I+1)*24),iamge1.Canvas,Rect(0, 0, 24, 24)); end; end; end;
var BM:TBitMap; begin BM:=TBitMap.Create ; try Image1.AutoSize:=True; BM.Width:=Image1.Width ; BM.Height:=Image1.Height ; BM.Canvas.Draw(0,0,Image1.Picture.Graphic);
begin
Image2.Stretch := True;
Image2.Picture.Assign(Image1.Picture);
end;
楼上的答对了,但是如果image2很大的话,
显示就不好看了
Row,Col:integer;
begin
Row:=round(Image2.height/24);
Col:=round(Image2.width/24);
for I := 0 to Row - 1 do
begin
for J := 0 to Col - 1 do
begin
Form1.Image2.Canvas.CopyRect(Rect(J*24,I*24,(J+1)*24, (I+1)*24),iamge1.Canvas,Rect(0, 0, 24, 24));
end;
end;
end;
BM:TBitMap;
begin
BM:=TBitMap.Create ;
try
Image1.AutoSize:=True;
BM.Width:=Image1.Width ;
BM.Height:=Image1.Height ;
BM.Canvas.Draw(0,0,Image1.Picture.Graphic);
image2.Canvas.Brush.Bitmap:=BM;
image2.Canvas.FillRect(Rect(0,0,Image2.Width ,Image2.Height));
finally
Bm.Free ;
end;