This project has moved. For the latest updates, please go here.

How to place a text label in center of polygon ?

Mar 7, 2011 at 6:05 AM

Hi guys,

Can anyone tell me how to set text label of a polygon in center ? And how to display only one label of each polygon ? Because some of my polygons have more than one label but place in different positions. I tried modified in 

myLabel.Style.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Right;
myLabel.Style.VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Middle;
myLabel.Style.Offset = new PointF(1, 1);
but It doesn't seem to take effect.

Please help me


Mar 8, 2011 at 8:25 AM

You can set how polygons are being labeled by setting LabelLayers MutiPartGeometryBehaviour to e.g.


The label then -should be- placed relative to the centroid of that geometry.

Hth FObermaier

Mar 10, 2011 at 12:54 AM

@FObermaier, It worked, thanks.

myLabel.MultipartGeometryBehaviour = LabelLayer.MultipartGeometryBehaviourEnum.Largest;