正在加载图片...
3.为视类添加键盘消息响应函数 2.1 void CDocView View: OnChar(UINT nChar, UINT nRepCnt, UINT nFlags if(nChar== RETURN)∥如果按下回车键 m strDisplay Empty 0: m nline++ else if(( m strDisplay. GetLength0<64)∥当前行字符数小于64 m strDisplay + nchar; CClientDC dc(this) TEⅩ TMETRIC tm; dc. Get TextMetrics(&tm) int nLineheight =tm. tmHeight tm tmEXternaILeading dc Textout(O, m nLine * nLine Height, m strDisplay) CView: OnChar(nChar, nRepCnt, nF lags)3.为视类添加键盘消息响应函数 2.1 void CDocViewView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if(nChar == VK_RETURN) //如果按下回车键 { m_strDisplay.Empty(); m_nLine++; } else if(m_strDisplay.GetLength() < 64) //当前行字符数小于64 m_strDisplay += nChar; CClientDC dc(this); TEXTMETRIC tm; dc.GetTextMetrics(&tm); int nLineHeight = tm.tmHeight + tm.tmExternalLeading; dc.TextOut(0, m_nLine * nLineHeight, m_strDisplay); CView::OnChar(nChar, nRepCnt, nFlags); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有