Map as only control on Form fails to display Zoombar, Scalebar, and Version.

Description

As reported on the MapWinGIS discourse site, it was discovered that if the OCX was placed along with certain other controls (which is most common) then the various map decorations (Zoombar, Scalebar, etc.) were visible, but if the OCX was the only control on the form, these decorations were not visible.

These decorations rely on GDI+, and the problem was introduced in release 5.2.4, in which initialization of GDI+ was moved from DLL startup (very broad, and inappropriate) to Map control construction (more narrow).

Environment

None

Activity

Show:
Jerry Faust
August 17, 2020, 6:43 AM

The GDI Brushes and Pens used to draw the Zoombar, Scalebar, etc., were defined as stack-based (non-pointer) variables in the map, and initialized in the constructor BEFORE GdiplusStartup was called, and thus their initialization was failing. The code worked in prior versions of the map since Gdiplus was started at DLL load-time, before the map was constructed.

I changed the variables to pointers, and initialized them after initial construction of the map, and that resolved the problem. I also had to modify their usage in Map_Scalebar.cpp since they were now pointer variables.

Assignee

Jerry Faust

Reporter

Jerry Faust

Labels

None

Fix versions

Affects versions

Priority

Medium
Configure