这是个文本程序,为什么会 'operator +=' is ambiguous
voidCTextView::OnChar(UINTnChar,UINTnRepCnt,UINTnFlags){//TODO:Addyourmessagehandlerc...
void CTextView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this);
CFont font;
font.CreatePointFont(300,_T("华文行楷"),NULL);
CFont *pOldFont = dc.SelectObject(&font);
TEXTMETRIC tm;
dc.GetTextMetrics(&tm);
if( 0x0d == nChar)
{
m_strLine.Empty();
m_ptOrigin.y += tm.tmHeight;
}
else if( 0x08 == nChar)
{
COLORREF clr = dc.SetTextColor(dc.GetBkColor());
dc.TextOut(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
m_strLine = m_strLine.Left(m_strLine.GetLength() - 1);
dc.SetTextColor(clr);
}
else
{
m_strLine += nChar;
}
CSize sz = dc.GetTextExtent(m_strLine);
CPoint pt;
pt.x = m_ptOrigin.x + sz.cx;
pt.y = m_ptOrigin.y;
SetCaretPos(pt);
dc.TextOut(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
dc.SelectObject(pOldFont);
CView::OnChar(nChar, nRepCnt, nFlags);
} 展开
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this);
CFont font;
font.CreatePointFont(300,_T("华文行楷"),NULL);
CFont *pOldFont = dc.SelectObject(&font);
TEXTMETRIC tm;
dc.GetTextMetrics(&tm);
if( 0x0d == nChar)
{
m_strLine.Empty();
m_ptOrigin.y += tm.tmHeight;
}
else if( 0x08 == nChar)
{
COLORREF clr = dc.SetTextColor(dc.GetBkColor());
dc.TextOut(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
m_strLine = m_strLine.Left(m_strLine.GetLength() - 1);
dc.SetTextColor(clr);
}
else
{
m_strLine += nChar;
}
CSize sz = dc.GetTextExtent(m_strLine);
CPoint pt;
pt.x = m_ptOrigin.x + sz.cx;
pt.y = m_ptOrigin.y;
SetCaretPos(pt);
dc.TextOut(m_ptOrigin.x,m_ptOrigin.y,m_strLine);
dc.SelectObject(pOldFont);
CView::OnChar(nChar, nRepCnt, nFlags);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询