功能:
在指定位置输出文本。
声明:
void outtextxy(
int x,
int y,
const char* text,
PIMAGE pimg = NULL
);
void outtextxy(
int x,
int y,
CHAR c,
PIMAGE pimg = NULL
);
void outtextxy(
int x,
int y,
const wchar_t* text,
PIMAGE pimg = NULL
);
void outtextxy(
int x,
int y,
wchar_t c,
PIMAGE pimg = NULL
);
参数:
x
文本输出位置的 x 坐标(文本实际位置与文本对齐方式、文本倾斜角度等相关)。
y
文本输出位置的 y 坐标(文本实际位置与文本对齐方式、文本倾斜角度等相关)。
text
要输出的文本内容。
c
要输出的字符。
pimg
要输出文本的目标图像(如果为 NULL,则输出到窗口)。
返回值:
(无)
示例:
// 示例1:输出固定内容的字符串
const char* s = "Hello World";
outtextxy(10, 20, s);
// 示例2:输出字符
char c = 'A';
outtextxy(10, 40, c);
// 示例3:输出格式化字符串。先将数字格式化输出成字符串再输出。
char s[32];
snprintf(s, sizeof(s), "value:%d", 1024);
outtextxy(10, 60, s);
// 示例3 可以直接用 xyprintf 代替
xyprintf(10, 60, "value:%d", 1024);