Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using

((AxMapControl)myMap.AddShapeFile( directory, shapeFileName)

To display a shape file which has road data. Now the roads display properly, but the road names aren't displaying. How can I turn on the roads? I don't need exact instructions just point me in the right direction please. I'm sorry this is such a novice question. I'm using ArcEngine 2010 and C#.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Create the layer symbology in ArcMap and save it as a *.lyr and load the shape file using the *.lyr file Sample_Save_a_layerfile. The benefit to do this using a lyr-file is that you can easily change it later on without changing the code. Take a look here if you want to do it in code: Working with labels and annotation

Just to display the attribute:

ILayer layer = axMapControl1.Map.get_Layer(0);
IGeoFeatureLayer geoLayer = layer as IGeoFeatureLayer;
geoLayer.DisplayAnnotation = true;
axMapControl1.Refresh(esriViewDrawPhase.esriViewAll, null, null);
share|improve this answer
    
I just clicked "label features in this layer" , and saved and it worked, do you have any idea how to do this sequence programatically in ArcEngine? –  patrick Oct 26 '10 at 14:32
1  
Updated with resource on how to add labels using code. –  MathiasWestin Oct 26 '10 at 15:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.