TabbedTextOutA function (winuser.h)

The TabbedTextOut function writes a character string at a specified location, expanding tabs to the values specified in an array of tab-stop positions. Text is written in the currently selected font, background color, and text color.

Syntax

LONG TabbedTextOutA(
  [in] HDC       hdc,
  [in] int       x,
  [in] int       y,
  [in] LPCSTR    lpString,
  [in] int       chCount,
  [in] int       nTabPositions,
  [in] const INT *lpnTabStopPositions,
  [in] int       nTabOrigin
);

Parameters

[in] hdc

A handle to the device context.

[in] x

The x-coordinate of the starting point of the string, in logical units.

[in] y

The y-coordinate of the starting point of the string, in logical units.

[in] lpString

A pointer to the character string to draw. The string does not need to be zero-terminated, since nCount specifies the length of the string.

[in] chCount

The length of the string pointed to by lpString.

[in] nTabPositions

The number of values in the array of tab-stop positions.

[in] lpnTabStopPositions

A pointer to an array containing the tab-stop positions, in logical units. The tab stops must be sorted in increasing order; the smallest x-value should be the first item in the array.

[in] nTabOrigin

The x-coordinate of the starting position from which tabs are expanded, in logical units.

Return value

If the function succeeds, the return value is the dimensions, in logical units, of the string. The height is in the high-order word and the width is in the low-order word.

If the function fails, the return value is zero.

Remarks

If the nTabPositions parameter is zero and the lpnTabStopPositions parameter is NULL, tabs are expanded to eight times the average character width.

If nTabPositions is 1, the tab stops are separated by the distance specified by the first value in the lpnTabStopPositions array.

If the lpnTabStopPositions array contains more than one value, a tab stop is set for each value in the array, up to the number specified by nTabPositions.

The nTabOrigin parameter allows an application to call the TabbedTextOut function several times for a single line. If the application calls TabbedTextOut more than once with the nTabOrigin set to the same value each time, the function expands all tabs relative to the position specified by nTabOrigin.

By default, the current position is not used or updated by the TabbedTextOut function. If an application needs to update the current position when it calls TabbedTextOut, the application can call the SetTextAlign function with the wFlags parameter set to TA_UPDATECP. When this flag is set, the system ignores the X and Y parameters on subsequent calls to the TabbedTextOut function, using the current position instead.

Note  For Windows Vista and later, TabbedTextOut ignores text alignment when it draws text.
 

Note

The winuser.h header defines TabbedTextOut as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-misc-l1-5-1 (introduced in Windows 10, version 10.0.14393)

See also

DrawText

Font and Text Functions

Fonts and Text Overview

GetTabbedTextExtent

GrayString

SelectObject

SetBkColor

SetTextAlign

SetTextColor

TextOut