1 void CTextView::OnLButtonDown(UINT nFlags, CPoint point)
2 {
3 // TODO: Add your message handler code here and/or call default
4 m_ptOrigin=point;
5 SetCaretPos(point);
6 //SetCaretPos(m_ptSecond);一个类中同时只能有一个插入符
7 m_strLine.Empty();
8 CView::OnLButtonDown(nFlags, point);
9 }
3.回车与退行,字体
01 void CTextView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
02 {
03 // TODO: Add your message handler code here and/or call default
04 CClientDC dc(this); //设置字体
05 CFont font;
06 font.CreatePointFont(200,"华文楷体",NULL);
07 CFont *pOldFont=dc.SelectObject(&font);
08 TEXTMETRIC tm;
09 dc.GetTextMetrics(&tm);
10 if(0x0d==nChar)//回车