//Image2.Width := Image1.Picture.Graphic.Width;
  //Image2.Height := Image1.Picture.Graphic.Height;
  //Image2.Picture.Graphic.Width := Image1.Picture.Graphic.Width;
  //Image2.Picture.Graphic.Height := Image1.Picture.Graphic.Height;
在Form1上面放了两个image,image1用来load一个jpeg,然后想传递给image2,
想用上面两种方法都无法传递高度和宽度
 想用  Image2.Picture.Graphic.Assign(Image1.Picture.Graphic);也不行,
各位大虾能否高速是怎么回事?
应该怎么实现?
谢谢

解决方案 »

  1.   

    用Image2.Picture. Assign(Image1.Picture);
    应该可以吧
      

  2.   

    你的方法设置不了吗?
    image2.width:=image1.width;
    image2.picture:=image1.picture;
      

  3.   

    image2.width:=image1.width;
    image2.picture:=image1.picture;
      

  4.   

    procedure TfrmMain.pbDrawPaint(Sender: TObject);
    var
    img: TImage;
    begin
    img := TImage.Create(nil);
    img.SetBounds(pbDraw.Left, pbDraw.Top, pbDraw.Width, pbDraw.Height);
    with img.Canvas do
    begin
    Brush.Color := clBlack;
    FillRect(ClientRect);
    end;
    pbDraw.Canvas.CopyRect(img.Canvas.ClipRect, img.Canvas, pbDraw.Canvas.ClipRect);
    img.Free;
    end;
    pbDraw为paintbox,看看对你有没有帮助
      

  5.   

    我用Image2.Picture. Assign(Image1.Picture);
    没有问题啊
      

  6.   

    注意当load的是jpg文件时,
    canvas不可用。
    使用一个tbitmap作为过渡,
    先assign到此bitmap,
    然后可以用bitmat的CopyRect写到另一个image