Hi
I'm trying to grab the canvas of a GridPanel component which contains a couple of graphs (in two panels) and add them as an object of the same size to a TImageENVect component. I've got it to work, but the image I grab is not as good as the original. Am I missing something with this code or maybe there is a better way to do this?
Bruce.
var
bmp : TBitMap;
obj : integer;
begin
bmp:=TBitmap.Create;
try
bmp.Width:=GridPanel1.Width;
bmp.Height:=GridPanel1.Height;
bmp.PixelFormat:=pf32bit;
bmp.Canvas.CopyRect(Rect(0,0,bmp.Width,bmp.Height),Canvas,Rect(GridPanel1.Left,GridPanel1.Top,GridPanel1.Left+GridPanel1.Width,GridPanel1.Top+GridPanel1.Height));
obj:=Image.AddNewObject;
Image.ObjKind[obj]:=iekBITMAP;
Image.ObjSetTBitmap(obj,bmp);
Image.SetObjRect(obj,Rect(30,30,GridPanel1.Width,GridPanel1.Height),True);
finally
bmp.Free
end;