Hi
I have been using this function (see below) for many years to copy the content of an ImageEnView using TSlippyMap first into a TBitMap before transfering into another TImageEnMView control.
I draw to the canvas and add layers that overlay on the map.
I've tried all the ways to do this using the assign methods with a TBitMap or TIEBitmap without success.
What I've drawn on the canvas never makes it through, although the layers sometimes do.
There must be a method of doing this cleanly, because this should be easy peasy.
I've had long conversations with AI with no luck at all.#128558;
Can someone help me out?
There has got to be a better method of creating and saving bitmaps to make this transfer.
Bruce.
function CopyControlToBMP(AControl: TWinControl; border: boolean = False): TBitMap;
var
DC : HDC;
begin
result:=TBitmap.Create;
result.SetSize(AControl.ClientWidth,AControl.ClientHeight);
result.PixelFormat:=pf32bit;
DC:=GetWindowDC(AControl.Handle);
try
BitBlt(result.Canvas.Handle,0,0,result.Width,result.Height,DC,1,1,SrcCopy);
if border then
begin
result.Canvas.Brush.Color:=clBlack;
result.Canvas.FrameRect(rect(0,0,result.Width,result.Height));
end;
finally
ReleaseDC(AControl.Handle,DC);
end;
end;