Tag Archives: fonts

Display subscripts and superscripts in a RichTextBox in C#, version 2

The following examples show how to display subscripts and superscripts in a RichTextBox. Display subscripts and superscripts in a RichTextBox in C# Easily display subscripts and superscripts in a RichTextBox in C# Those were fairly simple examples, and Sudhir Srivastava … Continue reading

Posted in fonts, formatting | Tagged , , , , , , , , , , , , , | Leave a comment

Recursively draw equations in C#

The basic idea for recursively drawing equations is simple. Well, sort of simple. Classes represent different kinds of equations. A particular class knows how to draw its kind of equation. It uses other classes to draw its pieces. For example, … Continue reading

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

Draw improved text on a curve in C#

This example shows how to draw improved text along a curved path. The example Draw text on a curve in C# shows how to draw text along a curved path. Unfortunately the spacing between the letters is pretty mediocre in … Continue reading

Posted in algorithms, drawings, fonts, graphics, transformations | Tagged , , , , , , , , , , , , , , , | Leave a comment

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

Make pop buttons in C#

This example produces an interesting visual effect that I call “pop buttons.” The buttons grow and shrink when the mouse moves over them. The technique is remarkably simple and adds some extra interactivity to an otherwise ordinary program. The program’s … Continue reading

Posted in controls, fonts, user interface | Tagged , , , , , , , , , , , , , , , | Leave a comment

Understand AutoScaleMode in C#

A form’s AutoScaleMode property lets a form automatically resize itself when its font changes. This can be particularly useful with an aging user population that may have trouble seeing smaller fonts. To try to help users out, you can give … Continue reading

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

Draw transformed text in C#

This example uses the following Paint event handler to draw transformed text. // Draw some transformed text. private void Form1_Paint(object sender, PaintEventArgs e) { // Transform. e.Graphics.ScaleTransform(1.5f, 1.5f, MatrixOrder.Append); e.Graphics.RotateTransform(25, MatrixOrder.Append); e.Graphics.TranslateTransform(80, 30, MatrixOrder.Append); // Make a font. using (Font … Continue reading

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

Easily draw rotated text on a form in C#

The example Draw rotated text in C# shows how to draw rotated text. Unfortunately that method requires you to use code at run time to position the text. It’s not too hard but it’s inconvenient if you’re trying to draw … Continue reading

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

Draw numbered buttons and save them into files in C#

This example is very similar to the previous one Draw numbered circles and save them into files in C# except it draws its circles so they look like numbered buttons. The following code shows how the program draws the circles’ … Continue reading

Posted in drawing, fonts, graphics | Tagged , , , , , , , , , , | 4 Comments