olefjeld
asked on
Copy an image onto a new form, results in access violation
Hi,
Problem with the following code... I am copying an image from one form to another... If I use showmodal on the form, the access violation do not appear vefore I close the window...
uncommenting the zzommImage code, will result in the excact same problem...
What am I doing wrong ???
procedure TForm1.Image1DblClick(Send er: TObject);
var
zOrgImage : TBitmap;
zZoomMapRect : TRect;
//zZoomImage : TBitmap;
zWnd : TForm2;
begin
zWnd := TForm2.Create(Self);
zOrgImage := TBitmap.Create;
//zZoomImage := TBitmap.Create;
zOrgImage := Image1.Picture.Bitmap;
zZoomMapRect.TopLeft := Point(100, 100);
zZoomMapRect.BottomRight := Point(300, 300);
zWnd.Image1.Picture.Bitmap .Width := zWnd.Image1.Width;
zWnd.Image1.Picture.Bitmap .Height := zWnd.Image1.Height;
//zZoomImage.Canvas.CopyRe ct(Rect(0, 0,zWnd.Ima ge1.Width, zWNd.Image1.Height), zOrgImage.Canvas, zZoomMapRect);
//zWnd.Image1.Picture.Bitm ap.Assign( zZoomImage );
zWnd.Image1.Picture.Bitmap .Canvas.Co pyRect(Rec t(0,0,zWnd .Image1.Wi dth, zWNd.Image1.Height), zOrgImage.Canvas, zZoomMapRect);
zWnd.Show;
//zZoomImage.Free;
zOrgImage.Free;
end;
Problem with the following code... I am copying an image from one form to another... If I use showmodal on the form, the access violation do not appear vefore I close the window...
uncommenting the zzommImage code, will result in the excact same problem...
What am I doing wrong ???
procedure TForm1.Image1DblClick(Send
var
zOrgImage : TBitmap;
zZoomMapRect : TRect;
//zZoomImage : TBitmap;
zWnd : TForm2;
begin
zWnd := TForm2.Create(Self);
zOrgImage := TBitmap.Create;
//zZoomImage := TBitmap.Create;
zOrgImage := Image1.Picture.Bitmap;
zZoomMapRect.TopLeft := Point(100, 100);
zZoomMapRect.BottomRight := Point(300, 300);
zWnd.Image1.Picture.Bitmap
zWnd.Image1.Picture.Bitmap
//zZoomImage.Canvas.CopyRe
//zWnd.Image1.Picture.Bitm
zWnd.Image1.Picture.Bitmap
zWnd.Show;
//zZoomImage.Free;
zOrgImage.Free;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
think I went blind from looking at it for too long...
Cheers !