这个代码返回中文为什么会是乱码,麻烦各位大哥帮忙看看,谢谢!
int CBasicTextBox::AddMultiTextLongestLine ( MULTITEXT strText )
{
if ( !m_pFont )
{
GASSERT ( 0 && " " );
return 0;
}
STEXTPART sTEXTPART;
STEXTLINE sTEXTLINE;
int nLength = 0;
for ( int i = 0; i < 100; i++ )
{
if ( strText.strText[i] == "" ) continue;
if ( !strText.strText[i] ) continue;
CString strCurText = strText.strText[i];
for( int j = 0; j < strCurText.GetLength(); j++ )
{
if ( nLength < MULTITEXTSPLIT_LENGTH )
{
STEXTWORD sTEXTWORD;
sTEXTWORD.strWord = strCurText[j];
sTEXTWORD.dwColor = strText.dwColor[i];
m_pFont->GetTextExtent ( sTEXTWORD.strWord.GetString(), sTEXTWORD.strSize );
if( strCurText.GetLength() ) m_pFont->PushText( sTEXTWORD.strWord.GetString() );
sTEXTLINE.vectorWord.push_back ( sTEXTWORD );
sTEXTLINE.strSize.cx += sTEXTWORD.strSize.cx;
sTEXTLINE.strSize.cy = sTEXTWORD.strSize.cy;
}
else
{
sTEXTPART.dequeLine.push_back ( sTEXTLINE );
m_TextBox.push_back ( sTEXTPART );
m_nTotalLine++;
for ( ; m_nLimitLine < m_nTotalLine; --m_nTotalLine )
{
sTEXTPART = m_TextBox.front ();
DEQUETEXTLINE& dequeLine = sTEXTPART.dequeLine;
dequeLine.pop_front ();
if ( dequeLine.size () < 1 )
{
if ( m_ImageList.size () )
{
DeleteControl ( m_ImageList[0], 0 );
m_ImageList.pop_front ();
}
m_TextBox.pop_front ();
}
}
ReCalcRenderPos ();
sTEXTPART = STEXTPART();
sTEXTLINE = STEXTLINE();
STEXTWORD sTEXTWORD;
sTEXTWORD.strWord = strCurText[j];
sTEXTWORD.dwColor = strText.dwColor[i];
m_pFont->GetTextExtent ( sTEXTWORD.strWord.GetString(), sTEXTWORD.strSize );
if( strCurText.GetLength() ) m_pFont->PushText( sTEXTWORD.strWord.GetString() );
sTEXTLINE.vectorWord.push_back ( sTEXTWORD );
sTEXTLINE.strSize.cx += sTEXTWORD.strSize.cx;
sTEXTLINE.strSize.cy = sTEXTWORD.strSize.cy;
nLength = 0;
}
nLength++;
}
}
if ( nLength )
{
sTEXTPART.dequeLine.push_back ( sTEXTLINE );
m_TextBox.push_back ( sTEXTPART );
m_nTotalLine++;
for ( ; m_nLimitLine < m_nTotalLine; --m_nTotalLine )
{
sTEXTPART = m_TextBox.front ();
DEQUETEXTLINE& dequeLine = sTEXTPART.dequeLine;
dequeLine.pop_front ();
if ( dequeLine.size () < 1 )
{
if ( m_ImageList.size () )
{
DeleteControl ( m_ImageList[0], 0 );
m_ImageList.pop_front ();
}
m_TextBox.pop_front ();
}
}
ReCalcRenderPos ();
}
return (int)m_TextBox.size () - 1;
}