The DirectWrite Hello World sample shows how to display a simple text string in three, successively richer and complex, ways. It also helps provide an introduction to the IDWriteTextFormat, IDWriteTextLayout, and IDWriteTextRenderer interfaces. For a more detailed tutorial based, in part, on this sample, see Tutorial: Getting Started With DirectWrite.
This topic has the following parts:
The following screen shot shows one way to display a simple text string.

This sample is made up of four classes illustrating three methods of drawing text to the screen using DirectWrite and Direct2D. Each of the three tabs is implemented as a class that creates its own child window and has its own message processing callback. Additionally, there is a class that creates and handles the parent window and the tab control.
| Class | Description | Files |
|---|---|---|
| SimpleText | Renders simple text that has a single format. | SimpleText.cpp, SimpleText.h |
| MultiformattedText | Renders multiformatted text using an IDWriteTextLayout interface. | MultiformattedText.cpp, MultiformattedText.h |
| CustomText | Together with CustomTextRenderer, renders more styilized text. | CustomText.cpp, CustomText.h |
| CustomTextRenderer | Implements a custom renderer that renders multiformatted text with a bitmap brush filll. | CustomTextRenderer.cpp, CustomTextRenderer.h |
| TabWindow | Creates the main window, tab control, and initializes the other classes. | TabWindow.cpp, TabWindow.h |
Requirements
| Minimum supported client | Windows 7 or Windows Vista with Service Pack 2 (SP2) and Platform Update for Windows Vista |
|---|---|
| Minimum supported server | Windows Server 2008 R2 or Windows Server 2008 with Service Pack 2 (SP2) and Platform Update for Windows Server 2008 |
| Windows SDK | Windows Software Development Kit (SDK) for Windows 7 |
Downloading the Sample
This sample is available in the following locations.
| Location | Path/URL |
|---|---|
| Windows SDK | \Program Files\Microsoft SDKs\Windows\v7.0\Samples\Multimedia\DirectWrite\DWriteHelloWorld |
| Code Gallery | Download from MSDN Code Gallery |
Send comments about this topic to Microsoft
Build date: 11/22/2012