ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Copying from a slippymap into a TImageEnMView or TImageENview component.
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
256 Posts

Posted - Oct 18 2026 :  07:11:05  Show Profile  Reply
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;

xequte

39560 Posts

Posted - Oct 18 2026 :  14:56:55  Show Profile  Reply
Hi Bruce

What happens when you just use:

ImageEnView1.IO.SaveToFile('D:\map.jpg');

Which works fine when we test it here. If you're seeing something different, can you confirm what version of ImageEn you are using?

If you need location pins too, see the "Save as Image" method in the GeoMaps demo:

\Demos\InputOutput\GeoMaps\geomaps.dpr

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: