outtextxy

The function is used to output the string at the specified location.

void outtextxy(
	int x,
	int y,
	LPCTSTR str
);
void outtextxy(
	int x,
	int y,
	TCHAR c
);

Parameters

x

The coordinate value of the x-axis of the first letter when the string outputs.

y

The coordinate value of the y-axis of the first letter when the string outputs.

str

The pointer to the string to be output.

c

The character to be output.

Return Value

None

Remarks

The function does not change the current position.

There are two common encodings for strings: MBCS and Unicode. Vc6 New projects are MBCS code by default, and VC2008 and higher versions of VC default to Unicode encoding. LPCTSTR can be adapted to both codes. To accommodate both encodings, use TCHAR strings and related functions.

By default, the background of the output string is filled with the current background color. Use the function setbkmode to make the background portion of the text transparent or fill with a background color.

Examples

// Output string (VC6)
char s[] = "Hello World";
outtextxy(10, 20, s);
// Output string (VC6 / VC2008 / VC2010 / VC2012)
TCHAR s[] = _T("Hello World");
outtextxy(10, 20, s);
// Output characters (VC6)
char c = 'A';
outtextxy(10, 40, c);
// Output characters (VC6 / VC2008 / VC2010 / VC2012)
TCHAR c = _T('A');
outtextxy(10, 40, c);
// Output value, first format the number output as a string (VC6)
char s[5];
sprintf(s, "%d", 1024);
outtextxy(10, 60, s);
// Output value 1024, first format the number output as a string
 (VC2008 / VC2010 / VC2012)
TCHAR s[5];
_stprintf(s, _T("%d"), 1024);        // High-version VCs recommend the use of the _stprintf_s function
outtextxy(10, 60, s);