有两个image控件,image1里的图片是24*24大小的,我想把image1里的图片填满image2。如何实现呢?

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Image2.Stretch := True;
      Image2.Picture.Assign(Image1.Picture);
    end;
      

  2.   

    就是,
    楼上的答对了,但是如果image2很大的话,
    显示就不好看了
      

  3.   

    属性Image2.Stretch := True;
      

  4.   

    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;
      

  5.   

    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);
     
        image2.Canvas.Brush.Bitmap:=BM;
        image2.Canvas.FillRect(Rect(0,0,Image2.Width ,Image2.Height));
       finally
         Bm.Free ;
       end;