各位大虾,请帮我解释这几句话,好吗?谢谢!
下面是鼠标的例子,在客户按下鼠标左键时,将会显示鼠标的当前位置坐标
void CTestt1View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this);
char str[32];
sprintf(str,"(%d,%d)",point.x ,point.y);
dc.TextOut(point.x ,point.y ,str ,strlen(str));
CView::OnLButtonDown(nFlags, point);
}
各位大虾:
CClientDC dc(this); //这句话有什么用啊?
sprintf(str,"(%d,%d)",point.x ,point.y); //这句话有什么用?
//执行这句话后,str 的值是多少呢?
dc.TextOut(point.x ,point.y ,str ,strlen(str)); //这句话有什么用呢?
//这里为什么要 四个参数呢?
//确定一个位置 point.x ,point.y 就够了啊?
CView::OnLButtonDown(nFlags, point); //这句话有什么作用?
还有一个问题是,如果我把 sprintf(str,"(%d,%d)",point.x ,point.y); 注释掉
则显示的是乱码,这是什么原因呢?
谢谢!