Tag Archives: SmoothingMode

Get font size in pixels in C#

One oddity of the Font class is that its Size property returns font size in the units that were used to create the font. The Font class’s Unit property tells you the units used to create the font, but if … Continue reading

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

Draw smooth text in a GraphicsPath in C#

You can set a Graphics object’s TextRenderingHint property to AntiAliasGridFit to draw smooth text. However, if you place text in a GraphicsPath object and draw the GraphicsPath, then the TextRenderingHint property doesn’t give you smooth text. Instead you need to … Continue reading

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

Fill a shape with random lines in C#

Click and drag to draw a shape. When you release the mouse, the program closes the shape and fills it with random line segments. The following code shows how the program lets you draw a shape. // The points selected … Continue reading

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

Draw text filled with random colored circles in C#

This example shows how to draw text filled with random colored circles. The example Draw text filled with random colored lines in C# shows how to draw text filled with random colored lines. This example is similar except it fills … Continue reading

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

Draw text filled with random colored lines in C#

This example combines two previously described techniques to draw text filled with random colored lines. The example Draw text filled with random lines in C# shows how to draw text filled with random lines. The example Draw text in random … Continue reading

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

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

Draw text filled with random lines in C#

This example uses the following code to draw text filled with random lines. // Draw the lined-filled text. private void Form1_Paint(object sender, PaintEventArgs e) { const string TXT = “C# Helper”; // Make the result smoother. e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; e.Graphics.Clear(this.BackColor); … Continue reading

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

Draw text filled with text in C#

This program draws text filled with text. It’s very similar to the example Draw hollow text in C#, so you should see that example for most of the details. The big difference between the two programs is the brush they … Continue reading

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

Draw hollow text in C#

When the form loads, it sets ResizeRedraw to true so the form automatically repaints itself whenever it is resized. // Redraw on resize. private void Form1_Load(object sender, EventArgs e) { this.ResizeRedraw = true; } Strangely enough, you can’t set ResizeRedraw … Continue reading

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