DrawingContext::DrawText Method

Draws formatted text at the specified location.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)

public:
void DrawText(
	FormattedText^ formattedText, 
	Point origin
)

Parameters

formattedText
Type: System.Windows.Media::FormattedText

The formatted text to be drawn.

origin
Type: System.Windows::Point

The location where the text is to be drawn.

ExceptionCondition
ObjectDisposedException

The object has already been closed or disposed.

The following example shows how to draw text to a DrawingVisual using a DrawingContext object. A drawing context is returned by calling the RenderOpen method of a DrawingVisual object. You can draw graphics and text into a drawing context.

To draw text into the drawing context, use the DrawText method of a DrawingContext object. When you are finished drawing content into the drawing context, call the Close method to close the drawing context and persist the content.

No code example is currently available or this language may not be supported.
NoteNote

For the complete code sample from which the preceding code example was extracted, see Hit Test Using DrawingVisuals Sample.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft