【发布时间】:2017-08-31 21:24:53
【问题描述】:
所以我正在使用 Gdiplus 并尝试使用 Drawstring 方法输出一些文本。
我有
graphics.DrawString(&myVariable, -1, &myFont, Gdiplus::PointF(x, y), &brushVariable);
但是对于 &myVariable 参数,我想从我的 for 循环中打印出整数。因为它是一个整数,所以我需要把它变成一个字符串。我研究了如何使用 stringstream 和 to_string(i) 执行此操作,但是 DrawString 方法仍然给我一个错误,说我没有输入正确的参数。我知道这是 &myVariable 参数的问题,因为我不确定如何将 int 转换为可以使用 & 取消引用的字符串。 论据是: DrawString(std::string *, int, Gdiplus::font *, Gdiplus::PointF, Gdiplus::SolidBrush *);
【问题讨论】: