VC学习2

void CMyView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
 // TODO: Add your message handler code here and/or call default
 CClientDC dc(this);
 CRect rect;
 dc.GetClipBox(rect);
 CSize size;
 size=dc.GetTextExtent((LPCTSTR)&nChar);
 pos.x+=size.cx;
 if (pos.x>rect.Width()-10)
 {
  pos.y+=size.cy;
  pos.x=10;
 }
 dc.TextOut(pos.x,pos.y,(LPCTSTR)&nChar);
 CView::OnChar(nChar, nRepCnt, nFlags);
}

你可能感兴趣的:(VC学习2)