Tag Archives: draw string

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

Justify paragraphs in C#

This example adds the ability to justify paragraphs to the example The example Align text by lines in C#. This is a bit more complicated than aligning text on the left, right, or center. (I don’t know why Microsoft didn’t … Continue reading

Posted in fonts, graphics, printing, strings | Tagged , , , , , , , , , , , , , , | Leave a comment

Align text by lines in C#

The example Draw paragraphs one line at a time in C# shows how to draw the lines of a paragraph one at a time. Once you can do that, it’s a simple matter to align text one line at a … Continue reading

Posted in fonts, graphics, printing, strings | Tagged , , , , , , , , , , , , , | 1 Comment

Draw paragraphs one line at a time in C#

My next few posts show how to draw paragraphs on a Graphics object in various ways. The examples draw on PictureBox controls, but it’s important to remember that they work with any Graphics object including the one that you are … Continue reading

Posted in graphics, printing, strings | Tagged , , , , , , , , , , | 1 Comment

Fully justify paragraphs of text in C#

The StringFormat class makes it fairly easy to left justify, right justify, or center a line of text, but strangely it doesn’t provide a method to fully justify a line of text (so it extends all the way to both … Continue reading

Posted in algorithms, fonts, graphics, printing, strings | Tagged , , , , , , , , , , , , , , , , , , , , | 4 Comments

Fully justify a line of text in C#

The StringFormat class makes it fairly easy to left justify, right justify, or center a line of text, but strangely it doesn’t provide a method to fully justify a line of text (so it extends all the way to both … Continue reading

Posted in fonts, graphics, printing, 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 , , , , , , , , , , , , , , , , , , , , , , | 2 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