VC(MFC)编程中遇到的问题..大家帮帮我.. 15
下面一段代码.....voidCTextView::OnChar(UINTnChar,UINTnRepCnt,UINTnFlags){CClientDCdc(this);...
下面一段代码.....
void CTextView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CClientDC dc(this);
TEXTMETRIC tm;
dc.GetTextMetrics(&tm);
if(13==nChar)
{
m_strLine.Empty();
m_ptOrigin.y+=tm.tmHeight;
}
else if(8==nChar)
{
COLORREF clr=dc.SetTextColor(dc.GetBkColor());
dc.TextOutW(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
m_strLine=m_strLine.Left(m_strLine.GetLength()-1);
dc.SetTextColor(clr);
}
else
{
m_strLine+=nChar; //就是这一句!
}
dc.TextOutW(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
CView::OnChar(nChar, nRepCnt, nFlags);
}
其中m_strLine是CString类的对象
m_ptOrigin是CPoint类的对象
m_strLine+=nChar;
这一句出现了如下错误:
1>c:\documents and settings\avex\桌面\1\text\text\textview.cpp(176) : error C2593: “operator +=”不明确
1> d:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1372): 可能是“ATL::CStringT<BaseType,StringTraits> &ATL::CStringT<BaseType,StringTraits>::operator +=(wchar_t)”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> d:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1365): 或“ATL::CStringT<BaseType,StringTraits> &ATL::CStringT<BaseType,StringTraits>::operator +=(unsigned char)”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> d:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1358): 或“ATL::CStringT<BaseType,StringTraits> &ATL::CStringT<BaseType,StringTraits>::operator +=(char)”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> 试图匹配参数列表“(CString, UINT)”时
哪里出了问题? 怎么改? 展开
void CTextView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CClientDC dc(this);
TEXTMETRIC tm;
dc.GetTextMetrics(&tm);
if(13==nChar)
{
m_strLine.Empty();
m_ptOrigin.y+=tm.tmHeight;
}
else if(8==nChar)
{
COLORREF clr=dc.SetTextColor(dc.GetBkColor());
dc.TextOutW(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
m_strLine=m_strLine.Left(m_strLine.GetLength()-1);
dc.SetTextColor(clr);
}
else
{
m_strLine+=nChar; //就是这一句!
}
dc.TextOutW(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
CView::OnChar(nChar, nRepCnt, nFlags);
}
其中m_strLine是CString类的对象
m_ptOrigin是CPoint类的对象
m_strLine+=nChar;
这一句出现了如下错误:
1>c:\documents and settings\avex\桌面\1\text\text\textview.cpp(176) : error C2593: “operator +=”不明确
1> d:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1372): 可能是“ATL::CStringT<BaseType,StringTraits> &ATL::CStringT<BaseType,StringTraits>::operator +=(wchar_t)”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> d:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1365): 或“ATL::CStringT<BaseType,StringTraits> &ATL::CStringT<BaseType,StringTraits>::operator +=(unsigned char)”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> d:\program files\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1358): 或“ATL::CStringT<BaseType,StringTraits> &ATL::CStringT<BaseType,StringTraits>::operator +=(char)”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> 试图匹配参数列表“(CString, UINT)”时
哪里出了问题? 怎么改? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询