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);