Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

DirectWrite Hello World Sample

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.

Screen shot of the DirectWrite Hello World sample that displays "Hello World using DirectWrite"

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.

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



Minimum supported clientWindows 7 or Windows Vista with Service Pack 2 (SP2) and Platform Update for Windows Vista
Minimum supported serverWindows Server 2008 R2 or Windows Server 2008 with Service Pack 2 (SP2) and Platform Update for Windows Server 2008
Windows SDKWindows Software Development Kit (SDK) for Windows 7


Downloading the Sample

This sample is available in the following locations.

Windows SDK\Program Files\Microsoft SDKs\Windows\v7.0\Samples\Multimedia\DirectWrite\DWriteHelloWorld
Code GalleryDownload from MSDN Code Gallery




Ajouts de la communauté

© 2015 Microsoft