ThinkGeo.com    |     Documentation    |     Premium Support

LeaderLineStyle sample

I am intrigued by the leaderlinestyle option in TextStyle class. What is this used for and are there any samples I can see of how it should be used?

Hi Jake,

The code as below should be helpful.

 shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Capital1("CITY_NAME");
        shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.XOffsetInPixel = 25;
        shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.YOffsetInPixel = 25;
        shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LeaderLineRule = LabelLeaderLinesRule.AllowLeaderLines;
        shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LeaderLineMinimumLengthInPixels = 1;
        shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LeaderLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Red, 1, true);

        shapeFileLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

Please notice, if you don’t set the xoffset and yoffset, generally the leaderline won’t shows. Because the default value of LeaderLineMinimumLengthInPixels equal 10, it’s the min pixel distance in screen, when the distance between label and shape is further than the default value, the leaderline will be drawn.

Regards,

Ethan