1 WCHAR wszContent[1024] ={L"安装问题,下面根据自己今天下午的安装做个总结,和大家分享,水平有限,请大家多多指导! 在OpenNI 1.X的时候,OpenNI的整个framework是采用类似plug-in的机制,让开发者可以利用OpenNI所提供的标准框架,使用中间件(Middl"}; 2 wstring contentwStr(wszContent); 3 wstring contentRetStr; 4 char str[1024] = {0}; 5 6 SIZE szSpace = { 0 }; 7 8 HDC hdc = GetDC(m_hWnd); 9 HFONT hDefaultFont = (HFONT)m_pContentText->GetFont(); 10 HFONT holdFont = (HFONT)SelectObject(hdc,hDefaultFont); 11 12 int beginflag = 0; 13 int offIndex = 16; //一行的汉字字数 14 15 for (size_t i=16;i<contentwStr.length();i++){ 16 wstring contentSegment = contentwStr.substr(beginflag,offIndex); 17 18 int itext = WideCharToMultiByte(CP_ACP,NULL,contentSegment.c_str(),-1,NULL,0,NULL,NULL); 19 WideCharToMultiByte( CP_ACP,0,contentSegment.c_str(),-1,str,itext,NULL,NULL ); 20 GetTextExtentPoint32(hdc,str,itext - 1,&szSpace); 21 22 if (contentwStr.find_last_of(contentSegment) == contentwStr.length()-1){ 23 contentRetStr+= contentSegment; 24 break; 25 } 26 27 if (szSpace.cx >= 210){ 28 contentRetStr+= contentSegment.substr(0,contentSegment.length()-1); 29 contentRetStr+=L"{n}{y 18}";//Y 调置行距 30 beginflag = i; 31 i+=16; 32 if (i>contentwStr.length()){ 33 i = contentwStr.length() - 2; 34 } 35 offIndex = 16; 36 }else{ 37 offIndex++; 38 } 39 } 40 41 int itext = WideCharToMultiByte(CP_ACP,NULL,contentRetStr.c_str(),-1,NULL,0,NULL,NULL); 42 WideCharToMultiByte( CP_ACP,0,contentRetStr.c_str(),-1,str,itext,NULL,NULL ); 43 CDuiString contentStr = str; 44 m_pContentText->SetText(contentStr.GetData()); 45 SelectObject(hdc,holdFont);