Tag Archives: DrawString

Draw text with colors reversed along a sine wave in C#

The post Draw text with colors reversed along a diagonal line in C# demonstrated a general technique for splitting text (or any other image) into pieces that are drawn differently. That example showed how to draw text with some areas … Continue reading

Posted in drawing, fonts, graphics | Tagged , , , , , , , , , | Leave a comment

Draw text with colors reversed along a diagonal line in C#

The post Draw text with colors reversed in its upper and lower halves in C# showed how you can draw text that has upper and lower halves with colors switched. This example uses a similar technique to switch the colors … Continue reading

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

Draw text with colors reversed in its upper and lower halves in C#

This example and the two that follow show how to draw text with an interesting visual effect. The idea is quite simple. Make two bitmaps showing the text with its different color schemes. Then use those images to fill different … Continue reading

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

Extract text from a metafile in C#

The example Enumerate the records in a metafile in C# shows how to list the records in a metafile. This example lists the records, looks for those that represent DrawString commands, and extracts their text. The following code shows the … Continue reading

Posted in algorithms, graphics | Tagged , , , , , , , , , , , | 2 Comments

See how much text fits in a rectangle in C#

This program determines how much text fits in the left PictureBox and draws it. It then draws the remaining text in the right PictureBox. If you change the form’s size, the size of the PictureBox controls change so how much … Continue reading

Posted in fonts, graphics, strings | Tagged , , , , , , , , , , , , , , , , , | Leave a 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

Draw text filled with a picture in C#

This example shows how you can draw text filled with a picture. It uses two images added to the project as resources. (To add resources to the project, open the Project menu and select the Properties command at the very … Continue reading

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