如何使每个字符串出现在新行中?
int i = 1;
char *s = *environ;
for (; s; i++) {
DrawText(hdc, s, -1, &rect,
DT_WORDBREAK | DT_EDITCONTROL | DT_BOTTOM);
s = *(environ + i);
}发布于 2015-12-10 05:47:00
使用DrawText函数返回的值(绘制文本的高度)来偏移下一行文本的矩形。
int i = 1;
char *s = *environ;
for (; s; i++) {
int height = DrawText(hdc, s, -1, &rect,
DT_WORDBREAK | DT_EDITCONTROL | DT_BOTTOM);
OffsetRect(&rect, 0, height);
s = *(environ + i);
}发布于 2015-12-09 22:39:42
您需要在每个字符串的末尾添加一个新行字符'\n'。
更正:我以为所有的字符串都会被一次提取出来...
https://stackoverflow.com/questions/34181233
复制相似问题