String Format Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the StringFormat C++ class.

StringFormat Functions and Corresponding Wrapper Methods

Flat function Wrapper method Remarks
GpStatus WINGDIPAPI GdipCreateStringFormat( INT formatAttributes, LANGID language, GpStringFormat **format )
StringFormat::StringFormat( IN INT formatFlags = 0, IN LANGID language = LANG_NEUTRAL )
Creates a StringFormat object based on string format flags and a language.
GpStatus WINGDIPAPI GdipStringFormatGetGenericDefault(GpStringFormat **format)
StringFormat* StringFormat::GenericDefault()
Creates a generic, default StringFormat object.
GpStatus WINGDIPAPI GdipStringFormatGetGenericTypographic(GpStringFormat **format)
StringFormat* StringFormat::GenericTypographic()
Creates a generic, typographic StringFormat object.
GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
StringFormat::~StringFormat()
Releases resources used by the StringFormat object.
GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat)
StringFormat::StringFormat( IN const StringFormat *format )
Creates a StringFormat object from another StringFormat object.
GpStatus WINGDIPAPI GdipSetStringFormatFlags(GpStringFormat *format, INT flags)
Status StringFormat::SetFormatFlags(IN INT flags)
Sets the format flags for this StringFormat object. The format flags determine most of the characteristics of a StringFormat object.
GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat *format, INT *flags)
INT StringFormat::GetFormatFlags() const
Gets the string format flags for this StringFormat object.
GpStatus WINGDIPAPI GdipSetStringFormatAlign(GpStringFormat *format, StringAlignment align)
Status StringFormat::SetAlignment(IN StringAlignment align)
Sets the line alignment of this StringFormat object in relation to the origin of the layout rectangle. The line alignment setting specifies how to align the string vertically in the layout rectangle. The layout rectangle is used to position the displayed string.
GpStatus WINGDIPAPI GdipGetStringFormatAlign(GDIPCONST GpStringFormat *format, StringAlignment *align)
StringAlignment StringFormat::GetAlignment() const
Gets an element of the StringAlignment enumeration that indicates the character alignment of this StringFormat object in relation to the origin of the layout rectangle. A layout rectangle is used to position the displayed string.
GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat *format, StringAlignment align)
Status StringFormat::SetLineAlignment(IN StringAlignment align)
Sets the line alignment of this StringFormat object in relation to the origin of the layout rectangle. The line alignment setting specifies how to align the string vertically in the layout rectangle. The layout rectangle is used to position the displayed string.
GpStatus WINGDIPAPI GdipGetStringFormatLineAlign(GDIPCONST GpStringFormat *format, StringAlignment *align)
StringAlignment StringFormat::GetLineAlignment() const
Gets an element of the StringAlignment enumeration that indicates the line alignment of this StringFormat object in relation to the origin of the layout rectangle. The line alignment setting specifies how to align the string vertically in the layout rectangle. The layout rectangle is used to position the displayed string.
GpStatus WINGDIPAPI GdipSetStringFormatTrimming( GpStringFormat *format, StringTrimming trimming )
Status StringFormat::SetTrimming(IN StringTrimming trimming)
Sets the trimming style for this StringFormat object. The trimming style determines how to trim a string so that it fits into the layout rectangle.
GpStatus WINGDIPAPI GdipGetStringFormatTrimming( GDIPCONST GpStringFormat *format, StringTrimming *trimming )
StringTrimming StringFormat::GetTrimming() const
Gets an element of the StringTrimming enumeration that indicates the trimming style of this StringFormat object. The trimming style determines how to trim characters from a string that is too large to fit in the layout rectangle.
GpStatus WINGDIPAPI GdipSetStringFormatHotkeyPrefix(GpStringFormat *format, INT hotkeyPrefix)
Status StringFormat::SetHotkeyPrefix(IN HotkeyPrefix hotkeyPrefix)
Sets the type of processing that is performed on a string when the hot key prefix, an ampersand (&), is encountered. The ampersand is called the hot key prefix and can be used to designate certain keys as hot keys.
GpStatus WINGDIPAPI GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat *format, INT *hotkeyPrefix)
HotkeyPrefix StringFormat::GetHotkeyPrefix() const
Gets an element of the HotkeyPrefix enumeration that indicates the type of processing that is performed on a string when a hot key prefix, an ampersand (&), is encountered.
GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL firstTabOffset, INT count, GDIPCONST REAL *tabStops)
Status StringFormat::SetTabStops( IN REAL firstTabOffset, IN INT count, IN const REAL *tabStops )
Sets the offsets for tab stops in this StringFormat object.
GpStatus WINGDIPAPI GdipGetStringFormatTabStops(GDIPCONST GpStringFormat *format, INT count, REAL *firstTabOffset, REAL *tabStops)
Status StringFormat::GetTabStops( IN INT count, OUT REAL *firstTabOffset, OUT REAL *tabStops ) const
Gets the offsets of the tab stops in this StringFormat object.
GpStatus WINGDIPAPI GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *format, INT * count)
INT StringFormat::GetTabStopCount() const
Gets the number of tab-stop offsets in this StringFormat object.
GpStatus WINGDIPAPI GdipSetStringFormatDigitSubstitution(GpStringFormat *format, LANGID language, StringDigitSubstitute substitute)
Status StringFormat::SetDigitSubstitution( IN LANGID language, IN StringDigitSubstitute substitute )
Sets the digit substitution method and the language that corresponds to the digit substitutes.
GpStatus WINGDIPAPI GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat *format, LANGID *language, StringDigitSubstitute *substitute)
StringDigitSubstitute StringFormat::GetDigitSubstitutionMethod( ) const
gets an element of the StringDigitSubstitute enumeration that indicates the digit substitution method that is used by this StringFormat object.
The language parameter in the flat function is a 16-bit value that specifies the language to use.
GpStatus WINGDIPAPI GdipGetStringFormatMeasurableCharacterRangeCount( GDIPCONST GpStringFormat *format, INT *count )
INT StringFormat::GetMeasurableCharacterRangeCount()
gets the number of measurable character ranges that are currently set. The character ranges that are set can be measured in a string by using the Graphics::MeasureCharacterRanges method.
GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges( GpStringFormat *format, INT rangeCount, GDIPCONST CharacterRange *ranges )
Status StringFormat::SetMeasurableCharacterRanges( IN INT rangeCount, IN const CharacterRange *ranges )
Sets a series of character ranges for this StringFormat object that, when in a string, can be measured by the Graphics::MeasureCharacterRanges method.