Tag Archives: MeasureCharacterRanges

Draw text on a circle in C#

This example uses some of the techniques described in the post Measure character positions when drawing long strings in C# to draw text on a circle. The previous post explains how to determine where the characters in a string will … Continue reading

Posted in algorithms, fonts, geometry, graphics, strings | Tagged , , , , , , , , , , , , , , , , , , , | 1 Comment

Make a sunburst chart in C#, Part 4

The previous post showed how to make a sunburst chart with curved text. This example extends that one so it can draw multi-line text. The previous post used the DrawTextOnArc method to draw curved text. The text is a distance … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , | 1 Comment

Make a sunburst chart in C#, Part 3

The post Make a sunburst chart in C#, Part 1 shows how to build a basic sunburst chart. The post Make a sunburst chart in C#, Part 2 enhances that example by drawing each node’s text at an angle so … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , | 1 Comment

Measure character positions when drawing long strings in C#

The example Measure character positions in a drawn string in C# uses the Graphics class’s MeasureCharacterRanges method to find the positions where characters in a string will be drawn. Unfortunately this method requires you to call a StringFormat object’s SetMeasurableCharacterRanges … Continue reading

Posted in algorithms, drawing, fonts, graphics, strings | Tagged , , , , , , , , , , , , , , , | 2 Comments

Draw text in random colors in C#

This example shows how you can draw text in random colors. The example Measure character positions in a drawn string in C# shows how to determine where the characters in a string will be drawn. This example uses similar code … Continue reading

Posted in drawing, fonts, graphics, strings | Tagged , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Get font metrics in C#

The Font and FontFamily classes provide lots of information about a font’s metrics, but that information is kind of hard to understand. The following list describes the key metrics. Internal Leading – Space above the characters that is still considered … Continue reading

Posted in algorithms, drawing, fonts, graphics, strings | Tagged , , , , , , , , , , , , , , , , , , , , , , | 3 Comments

Measure character positions in a drawn string in C#

You can use the Graphics class’s MeasureCharacterRanges method to measure character positions in a drawn string. This method returns information about the regions where strings of characters would be drawn by the Graphics object’s DrawString method. The DrawStringWithCharacterBounds method shown … Continue reading

Posted in algorithms, drawing, fonts, graphics, strings | Tagged , , , , , , , , , , , , , , , | 3 Comments