Muokkaa

Jaa


DrawTextWrap function

[DrawTextWrap is available through Windows XP with Service Pack 2 (SP2). It might be altered or unavailable in subsequent versions. It is recommended to use DrawText directly instead.]

Draws formatted text in the specified rectangle. It formats the text according to the specified method (expanding tabs, justifying characters, breaking lines, and so on). This function wraps a call to DrawText.

Syntax

int WINAPI DrawTextWrap(
  _In_    HDC              hdc,
  _Inout_ LPCTSTR          lpString,
  _In_    int              nCount,
  _Inout_ LPRECT           lpRect,
  _In_    UINT             uFormat,
  _In_    LPDRAWTEXTPARAMS lpDTParams
);

Parameters

hdc [in]

Type: HDC

A handle to the device context.

lpString [in, out]

Type: LPCTSTR

A pointer to a buffer that contains the text to draw. If the nCount parameter is -1, the string must be null-terminated.

If uFormat includes DT_MODIFYSTRING, the function might add up to four additional characters to this string. The buffer that contains the string should be large enough to accommodate these extra characters.

nCount [in]

Type: int

The length of the string pointed to by lpString. If nCount is -1, then the lpString parameter is assumed to be a pointer to a null-terminated string and DrawText computes the character count automatically.

lpRect [in, out]

Type: LPRECT

A pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the text is to be formatted.

uFormat [in]

Type: UINT

The formatting options. See the documentation for DrawText for a complete list of options.

lpDTParams [in]

Type: LPDRAWTEXTPARAMS

A pointer to a DRAWTEXTPARAMS structure that specifies additional formatting options. This parameter can be NULL.

Return value

Type: int

If the function succeeds, the return value is the text height in logical units. If DT_VCENTER or DT_BOTTOM is specified, the return value is the offset from the top member of lprc to the bottom of the drawn text If the function fails, the return value is zero.

If the function fails, the return value is zero.

To get extended error information, call GetLastError.

Remarks

DrawTextWrap is not exported by name or declared in a public header. To use it, you must use GetProcAddress and request ordinal 415 from ComCtl32.dll to obtain a function pointer.

For additional remarks, please see DrawText.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
DLL
Comctl32.dll (version 6.0 or later)