Labels.DynamicVisibility makes labels disappear

Hello. I want the labels to be visible within a certain scale. When I zoom the map to a certain scale, the labels on the map are visible. When I zoom out the map to a certain scale, the labels on the map are not visible. I found two functions, Labels.MinVisibleScale and Labels.MaxVisibleScale. However, when I set DynamicVisibility to true, no matter how I modify the values of MaxVisibleScale and MinVisibleScale, these labels are not visible. The code is shown below. Where is the problem?

https://www.mapwindow.org/documentation/mapwingis4.9/group__labels__visibility.html#ga8046d21eefd1af4f7ca8382298e8916a

        Shapefile sf = new Shapefile();
        sf.CreateNew("", ShpfileType.SHP_POINT);
        Shape shp = new Shape();
        shp.Create(ShpfileType.SHP_POINT);

        MapWinGIS.Point pt = new MapWinGIS.Point();
        pt.x = 3;
        pt.y = 3;

        int index1 = shp.numPoints;
        shp.InsertPoint(pt, ref index1);

        int index2 = sf.NumShapes;
        sf.EditInsertShape(shp, ref index2);

        sf.Labels.AddLabel("label", 3, 3);
        sf.Labels.DynamicVisibility = true;
        sf.Labels.MaxVisibleScale = 10000000000000000;
        sf.Labels.MinVisibleScale = 0;

        axMap1.AddLayer(sf, true);

Can anyone help me? Thanks.
Or is it because I did n’t describe clearly?

Hello @Henry

I may have time to look at this later, but I believe it has to do with not having Projections or Tiles established, which establish map Scale and Zoom levels.

Jerry.

Ok, it looks like all you have to do is set a projection, something like

axMap1.Projection = tkMapProjection.PROJECTION_GOOGLE_MERCATOR;

I just doesn’t understand the concept of zoom levels or scale until a projection is set.

Regards,
Jerry.

Thanks a lot. It workes.

I use the MapWinGIS control as a CAD control. I mainly used to draw CAD graphics, so no projection was set. Now I set AxMap.Tiles.Provider property to ProviderNone, and change AxMap.Tiles.Visible property to false. In this way, I can continue to use it. Hope it will run well.

axMap1.TileProvider = tkTileProvider.ProviderNone;

Best wishes.
Henry