This project is read-only.

generateLabels display nothing

Sep 10, 2013 at 2:03 PM
I'm trying to generate labels automatically, but nothing is displayed on map component. It's impossible for me to find an explaination :
 shpfile.GenerateLabels 0, lpCentroid
  • shpfile.labels.count always return the same numbers of shapes in the shapefile, so labels seems to be generated.
  • labels.visibility is set on true
  • but when i check labels.label.isDrawn for a random index shape, it's always false.
  • I tried with different shapefile, polylines and polygons...
  • the map.numberversion is 1
  • I'm using vb6, with 4.8 ocx
Sep 11, 2013 at 8:50 AM
Are you using the latest OCX? We had some issues with opening dbf-files in write-mode. This has been fixed in newer versions.

Can you try Labels.Generate ( to create the labels?

And is a lbl-file created in the same location as your shapefile? If not do you have write-access in that folder?
If the lbl-file is not created you can try to save it using Labels.SaveToXML (
Sep 25, 2013 at 6:32 PM
Im using MapWinGIS OCX v in a c# project in VS2010.

I am not seeing labels on my streets layer, even though I have defined them just as I had in a test project (in which they display without issue).

Here is the code I use to open the shape file and add the layer.

Both the test app and the new app are using the same shapefile.
                fShpStreets.FastMode = ml.UseFastModeFlag; 
                int indexFieldRoadName = fShpStreets.Table.get_FieldIndexByName("WHOLESTNAM");
                fShpStreets.GenerateLabels(indexFieldRoadName, MapWinGIS.tkLabelPositioning.lpMiddleSegment, false);
                fShpStreets.Labels.AvoidCollisions = false;
                fShpStreets.Labels.CollisionBuffer = 10;
                fShpStreets.Labels.FrameVisible = true;
                fShpStreets.Labels.FrameTransparency = 254;
                fShpStreets.Labels.FrameBackColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.LightYellow));
                fShpStreets.Labels.FrameOutlineColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.LightYellow));
                fShpStreets.Labels.MinVisibleScale = 0.0;
                fShpStreets.Labels.MaxVisibleScale = 250000;
                fShpStreets.Labels.DynamicVisibility = true;

                if (!String.IsNullOrEmpty(ml.LayerLabelfile))
                mapLayerHandle = axMap1.AddLayer(fShpStreets, false);

Am I missing something?

Oct 2, 2013 at 9:52 AM
You are sure you are looking at your map in the correct scale, since you have set MaxVisibleScale?
And you are adding fShpStreets with visible is false at the last line.

Can you first start with a more simple labeling process by just calling 'GenerateLabels'. And perhaps you need to try other options of tkLabelPositioning.
Oct 3, 2013 at 10:43 AM
Edited Oct 3, 2013 at 10:50 AM
Thanks Paul,
I'll try to find time this week to try this, and l'll post here after.
OCX version is