我刚开始学MFC编程,碰到一个奇怪的问题,谁能解释一下?我在View的对角窗口上画一对交叉线,用以下代码无问题:
void CMy210View::OnLButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
CRect rect;
GetClientRect (&rect);
CClientDC dc(this);
dc.MoveTo(rect.left, rect.top);
dc.LineTo(rect.right , rect.bottom);
dc.MoveTo(rect.right, rect.top);
dc.LineTo(rect.left, rect.bottom); CView::OnLButtonDown(nFlags, point);
}
但用以下代码虽然也画出了交叉线,但不在View的窗口对角:
void CMy210View::OnLButtonDown(UINT nFlags, CPoint point) 
{
// TODO: Add your message handler code here and/or call default
CRect rect;
GetClientRect (&rect);
CClientDC dc(this);
dc.MoveTo(rect.top, rect.left);
dc.LineTo(rect.bottom, rect.right);
dc.MoveTo(rect.top, rect.right);
dc.LineTo(rect.bottom, rect.left); CView::OnLButtonDown(nFlags, point);
}
只不过是交换了顺序而已,我跟踪调试看到的Rect值也是完全一样的,为什么会画出不同结果呢?谁能解释一下呢?