Quantcast
Channel: MapWinGIS ActiveX Map and GIS Component
Viewing all articles
Browse latest Browse all 2341

New Post: Problems with DrawLabelEx in version 4.9.3.6

$
0
0
I am trying to update from MapWinGIS ActiveX component version 4.9.2 to 4.9.3.6 and now I cannot draw a label on a screen-referenced drawing layer. The old API had an AddDrawingLabel method in the AxMap class, but that has been deprecated, with the suggestion to use AxMap.DrawLabelEx instead.

I have a very simple test app, which consists of a single Windows Form that contains just the map control. I create a screen-referenced drawing layer and try to add a label in various ways, but none of them result in the display of the label. I am able to draw a line on that layer. What I find strange is that if I uncomment any one of the three lines below that attempt to add the label, then the line will not be displayed.

I have set the background color of the map control to a light gray to make sure that the text color does not match the background color of the map.

What am I missing?
    public Form1()
    {
        InitializeComponent();

        int handle = axMap1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList);
        var labels = axMap1.get_DrawingLabels(handle);

        var color = System.Convert.ToUInt32(
                System.Drawing.ColorTranslator.ToOle(Color.Green));
        labels.FontColor = color;

        //labels.AddLabel("Hello", 100, 100);
        //axMap1.DrawLabel("Hello", 100, 100, 0);
        //axMap1.DrawLabelEx(handle, "Hello", 100, 100, 0);

        axMap1.DrawLineEx(handle, 200, 200, 300, 300, 2, color);
        axMap1.Redraw();
    }

Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>