Hide Controls for printing

We have a feature that allows the user to print a WebGMaps.


How can I hide the controls so they are not printed?

procedure ShowMapControls( AWebGMaps: TWebGMaps; AVisible: Boolean );
{^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^}
begin
  AWebGMaps.ControlsOptions.ZoomControl.Visible        := AVisible;
  AWebGMaps.ControlsOptions.StreetViewControl.Visible  := AVisible;
  AWebGMaps.ControlsOptions.PanControl.Visible         := AVisible;
  AWebGMaps.ControlsOptions.MapTypeControl.Visible     := AVisible;
  AWebGMaps.ControlsOptions.ScaleControl.Visible       := AVisible;
  AWebGMaps.ControlsOptions.OverviewMapControl.Visible := AVisible;
  AWebGMaps.ControlsOptions.RotateControl.Visible      := AVisible;
end;

function GetMapJpg( AWebGMaps: TWebGMaps ): TGraphic;
{^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^}
begin
  ShowMapControls(AWebGMaps, False);
  try
    //Need to somehow refresh the map so the controls no longer show
    Result := AWebGMaps.ScreenShot(TImgType.itJpeg);
  finally
    ShowMapControls(AWebGMaps, True);
  end;
end;

Hi,


Please note that hiding the map controls is an asynchronous action.
In this case the screenshot will be taken before the controls are actually hidden.

We'll have to investigate if this behavior can be improved in a future version of the TMS VCL WebGMaps.

As a workaround you would have to separate the hiding of the controls and taking the screenshot in 2 different actions.
For example with two buttons, one button hides the controls, once the controls are hidden you can click the second button to take a screenshot.