IDWriteTextFormat::SetTextAlignment Method
Sets the alignment of text in a paragraph, relative to the leading and trailing edge of a layout box for a IDWriteTextFormat interface.
Syntax
virtual HRESULT SetTextAlignment(
DWRITE_TEXT_ALIGNMENT textAlignment
) = 0;
Parameter
- textAlignment
The text alignment option being set for the paragraph of type DWRITE_TEXT_ALIGNMENT. For more information, see Remarks.
Rückgabewert
Methode kann einen der folgenden Werte zurückgeben:
Rückgabecode | Beschreibung |
---|---|
S_OK | The method succeeded. |
E_INVALIDARG | The textAlignment argument is invalid. |
Hinweise
The text can be aligned to the leading or trailing edge of the layout box, or it can be centered. The following illustration shows text with the alignment set to DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_TEXT_ALIGNMENT_CENTER, and DWRITE_TEXT_ALIGNMENT_TRAILING, respectively.
Hinweis The alignment is dependent on reading direction, the above is for left-to-right reading direction. For right-to-left reading direction it would be the opposite.
See DWRITE_TEXT_ALIGNMENT for more information.
Beispiele
if (SUCCEEDED(hr))
{
hr = pTextFormat_->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER);
}
Anforderungen
Mindestens unterstützter Client |
Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista |
Mindestens unterstützter Server |
Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 |
Header |
Dwrite.h |
Bibliothek |
Dwrite.lib |
DLL |
Dwrite.dll |