How to place a text label in center of polygon ?

Mar 7, 2011 at 7: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

Thanks.

Coordinator
Mar 8, 2011 at 9:25 AM

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

MultipartGeometryBehaviourEnum.Largest

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

Hth FObermaier

Mar 10, 2011 at 1:54 AM

@FObermaier, It worked, thanks.

myLabel.MultipartGeometryBehaviour = LabelLayer.MultipartGeometryBehaviourEnum.Largest;