GenerateLabels

Apr 29, 2011 at 1:12 AM

When I use the GenerateLabels or the myshafefile.Labels.AddLabel,  I can't see the labels in my map, is someone tell me why, he is my code example.

                                axMap1.ShapeDrawingMethod=tkShapeDrawingMethod.dmNewWithLabels;
                                axMap1.set_LayerLabelsVisible(0, true)    

                                myshafefile.Labels.FrameVisible = true;
                                myshafefile.Labels.ScaleLabels = true;
                                myshafefile.Labels.DynamicVisiblity = true;                             
                                myshafefile.Labels.Alignment = tkLabelAlignment.laBottomLeft;
                                myshafefile.Labels.Visible =true;
                                myshafefile.GenerateLabels(1,tkLabelPositioning.lpLongestSegement,true);


                                for (int i = 0; i < myshafefile.NumShapes; i++)
                                {
                                    double x = myshafefile.get_Shape(i).Extents.xMin + (myshafefile.get_Shape(i).Extents.xMax - myshafefile.get_Shape(i).Extents.xMin) / 2;
                                    double y = myshafefile.get_Shape(i).Extents.yMin + (myshafefile.get_Shape(i).Extents.yMax - myshafefile.get_Shape(i).Extents.yMin) / 2;
                                    myshafefile.Labels.AddLabel(myshafefile.get_CellValue(1, i).ToString(), x,y, 0, 0);                                   
                                }

                                int handle = axMap1.AddLayer(myshafefile, true);
                                axMap1.ZoomToLayer(handle);
                                axMap1.Redraw();

Dec 1, 2011 at 3:33 PM

I'm having the same issue.  I've found out that if I change the user's permissions for the .DBF file to have 'write' permission, the labels will be displayed.  I'm wondering if there is a way to open the .DBF file without requiring the 'write' permission to be set.