在wxWidgets中,常见的字符串不能直接使用,而且照顾到跨平台的特性,所以字符串的处理通常是比较繁琐的,以下的代码均是工作中所所用到的片段。通过这样的方式可以将字符串进行格式化。并且由wxMessageBox弹出对话框,将字符串输出.
wxString strImagePath;
strImagePath.Printf(wxT(
"The picture adds to carry a mistake!!!"));
wxMessageBox(strImagePath,_( ));
还有一个方法是在声明wxSting时对构造函数进行初始化.并且将其赋值给另一个变量.
#ifndef PICTUREPROC_H_INCLUDED
#define PICTUREPROC_H_INCLUDED
const char defaultPicture[100]="img/pic/topmain.jpg";
const char rCallOpen0[100]="img/pic/rCallOpen0.jpg";
const char rCallOpen1[100]="img/pic/rCallOpen1.jpg";
#endif // PICTUREPROC_H_INCLUDED
wxString tempWxString(rCallOpen0,wxConvUTF8);
strImagePath = tempWxString;
本文转自阿汐 51CTO博客,原文链接:http://blog.51cto.com/axiii/90133,如需转载请自行联系原作者