各位大虾,请教一下:
我想实现在对话框中画图,鼠标点击客户区,然后可以以鼠标位置为中心画出一个矩形,但是画出来的并不是以鼠标当前的位置为中心,而是在鼠标点击位置的右下方,为什么呢?下面是代码,求解释。。
void CSample1Dlg::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
/*-------实现鼠标移动时窗口也在移动--------------*/
CDC *pControlDC=pWnd-> GetDC();
pControlDC-> SelectStockObject(WHITE_BRUSH);
pControlDC-> Rectangle(point.x-10,point.y-10,point.x+10,point.y+10);
CDialog::OnLButtonDown(nFlags, point);
}