Tag Archives: draw text

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

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 text on a curve in C#

The example Draw text on a line segment in C# shows how to draw text that follows a line segment. This example uses that code to draw text on a curve. The DrawTextOnPath method shown in the following code uses … Continue reading

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

Draw text on a line segment in C#

This example shows how you can draw text on a line segment. The key is the DrawTextOnSegment method shown in the following code. This method can draw text on a line segment or below a line segment. // Draw some … Continue reading

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

Render text onto a RenderTargetBitmap with WPF and C#

In earlier examples such as Easily render rotated text in a WPF program using C#, I explained how to render text in a WPF program. Those examples draw text on the program’s window at runtime. Sometimes you may want to … Continue reading

Posted in drawing, graphics, image processing, wpf, XAML | Tagged , , , , , , , , , , , , , , , | 3 Comments

Get font metrics in a WPF program using C#

This example explains how to get font metrics in a WPF application. It’s actually not too hard, it’s just hard to figure out how to do it. The font metrics are tucked away inside the FormattedText object and the Typeface … Continue reading

Posted in drawing, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Easily render rotated text in a WPF program using C#

The example Render text easily in a WPF program using C# shows how to make an extension method that makes rendering text easy in WPF. This example makes a similar extension method that helps you render rotated text. This is … Continue reading

Posted in drawing, extension methods, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , | 1 Comment

Render text filled with an image in a WPF program using C#

The example Render outlined text in a WPF program using C# shows how to draw text that is filled with one color and outlined with another. This example uses the following overridden OnRender to render text filled with an image. … Continue reading

Posted in drawing, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , | Leave a comment

Render outlined text in a WPF program using C#

The example Render text in a WPF program using C# shows how to draw basic text. This example uses the following overridden OnRender to draw outlined text. protected override void OnRender(DrawingContext drawingContext) { // Clear the background. Rect bg_rect = … Continue reading

Posted in drawing, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , | 2 Comments

Render text easily in a WPF program using C#

The example Render text in a WPF program using C# explains how to draw text in WPF code. This example uses the following extension method to make drawing text easier. // Draw text at the indicated location. public static void … Continue reading

Posted in drawing, extension methods, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , | 2 Comments