void FaultDialog::CutStringc(CString str)
{
int len; //多少字节换行
len = str.GetLength();
CString temp_str;
temp_str="";
int templen = 0;
for(int i = 0;i < len ;i++)
{
temp_str+=str[i];
int aaa = (int)str.GetAt(i);
if (aaa > 255)
{
templen+= 2;
}
{
int len; //多少字节换行
len = str.GetLength();
CString temp_str;
temp_str="";
int templen = 0;
for(int i = 0;i < len ;i++)
{
temp_str+=str[i];
int aaa = (int)str.GetAt(i);
if (aaa > 255)
{
templen+= 2;
}

此代码段展示了如何在MFC中通过CutStringc函数,逐字节读取字符串,并根据字节长度添加换行符(
),确保静态文本在显示时自动换行。通过计算每个字符的字节数,当总字节数超过30时进行换行操作。
最低0.47元/天 解锁文章
1315

被折叠的 条评论
为什么被折叠?



