MFC 按字节读取字符串 添加换行符 实现static text自动换行

来源:互联网 发布:织梦v57漏洞 编辑:程序博客网 时间:2024/06/05 16:52
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;
}
else
{
templen+= 1;
}
if(templen > 30)
{
CString strLineFeed = _T("\r\n");
temp_str=temp_str+strLineFeed;
templen = 0;
}
}
test_str=temp_str;
}
原创粉丝点击