我使用 MFC TextOut 在屏幕上放置一些文本,如下所示
std::string myIntToStr(int number)
{
std::stringstream ss;//create a stringstream
ss << number;//add number to the stream
return ss.str();//return a string with the contents of the stream
}
void MViewClass::DrawFunction()
{
CClientDC aDC(this);
// .. Drawing Code
aDC.TextOut(27, 50, ("my age is " + myIntToStr(23)).c_str());
}
但我收到错误消息“无法将参数 3 从 'const char *' 转换为 'const CString &'”。
TextOut 的文档显示了 CString 重载。我想将 CString 与 TextOut 一起使用,因为它允许我使用 myIntToStr 转换器。有什么建议么?