画矩形,请大家帮忙!!! 怎样通过OnMouseMove,LButtonDown,LButtonUp这三个函数在Ocx控件上画出矩形,好急好急,请大家帮帮我!!!!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 呵呵,刚刚做完一个画矩形void C3DCityBuilderView::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default m_bIsLButtonDown = TRUE; m_OldPoint = point; LButtonDownPoint = point; switch (m_curTool) { case ID_MAP_SELECT: if(curSelectMove != NULL) SetCursor(curSelectMove); break; case ID_MAP_ZOOMIN: if(curZoomInMove != NULL) SetCursor(curZoomInMove); break; case ID_MAP_ZOOMOUT: if(curZoomOutMove != NULL) SetCursor(curZoomOutMove); break; case ID_MAP_PAN: if(curPanMove != NULL) SetCursor(curPanMove); break; default: SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); break; } CView::OnLButtonDown(nFlags, point);}///////////////////////////////////////////////////////////////////////////void C3DCityBuilderView::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CDC *pdc = GetDC(); CRect rect; if(m_bIsLButtonDown) { switch (m_curTool) { case ID_MAP_SELECT: if(curSelectMove != NULL)// SetCursor(curSelectMove); break; case ID_MAP_ZOOMIN: if(curZoomInMove != NULL) SetCursor(curZoomInMove); DrawRect(pdc,point); break; case ID_MAP_ZOOMOUT: if(curZoomOutMove != NULL) SetCursor(curZoomOutMove); DrawRect(pdc,point); break; case ID_MAP_PAN: if(curPanMove != NULL) SetCursor(curPanMove); break; default: SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); break; } } ReleaseDC(pdc); CView::OnMouseMove(nFlags, point);}///////////////////////////////////////////////////////////////////////////void C3DCityBuilderView::OnLButtonUp(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default LButtonUpPoint = point;}////////////////////////////////////////////////////////////////////////////*$功能:用于绘制放大,缩小的边框$*/void C3DCityBuilderView::DrawRect(CDC * pdc,CPoint point){ CRect rect; rect.SetRect(LButtonDownPoint.x, LButtonDownPoint.y, m_OldPoint.x, m_OldPoint.y); if(m_bIsLButtonDown == 100) { rect.NormalizeRect(); pdc->DrawFocusRect(&rect); } else m_bIsLButtonDown = 100; rect.SetRect(LButtonDownPoint.x,LButtonDownPoint.y,point.x,point.y); rect.NormalizeRect(); pdc->DrawFocusRect(&rect); m_OldPoint = point; } IOCP在什么时机投递WSA_RECV? 关于时间问题 请求帮助! 谁能帮我解释一下什么是win spi socket里的"重叠操作"? 怎么用ado直接读取vfp数据库,而不用建数据源??? 怎样更改CEdit的字体和背景色??怎样想对话框或控件中插入图片为背景? 显示文档时,如何判断符号所占的空间? vc++做出来的exe文件在窗体的右上方是没有最大化和最小化按钮的,请问怎样实 头都快想爆了还没想出来! 2个不同类中如何传递句柄! 怎么做一个自定义的记录集,可以添加、删除、修改等功能 大侠指教多线程和CList类的问题! 把分散完,迷茫中,请各位老鸟指教"钱"程
void C3DCityBuilderView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_bIsLButtonDown = TRUE;
m_OldPoint = point;
LButtonDownPoint = point; switch (m_curTool)
{
case ID_MAP_SELECT:
if(curSelectMove != NULL)
SetCursor(curSelectMove);
break;
case ID_MAP_ZOOMIN:
if(curZoomInMove != NULL)
SetCursor(curZoomInMove);
break;
case ID_MAP_ZOOMOUT:
if(curZoomOutMove != NULL)
SetCursor(curZoomOutMove);
break; case ID_MAP_PAN:
if(curPanMove != NULL)
SetCursor(curPanMove);
break; default:
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
break;
}
CView::OnLButtonDown(nFlags, point);
}///////////////////////////////////////////////////////////////////////////void C3DCityBuilderView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC *pdc = GetDC();
CRect rect; if(m_bIsLButtonDown)
{ switch (m_curTool)
{
case ID_MAP_SELECT:
if(curSelectMove != NULL)
// SetCursor(curSelectMove);
break;
case ID_MAP_ZOOMIN:
if(curZoomInMove != NULL)
SetCursor(curZoomInMove);
DrawRect(pdc,point); break;
case ID_MAP_ZOOMOUT:
if(curZoomOutMove != NULL)
SetCursor(curZoomOutMove);
DrawRect(pdc,point);
break;
case ID_MAP_PAN:
if(curPanMove != NULL)
SetCursor(curPanMove);
break;
default:
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
break;
}
}
ReleaseDC(pdc);
CView::OnMouseMove(nFlags, point);
}
///////////////////////////////////////////////////////////////////////////
void C3DCityBuilderView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
LButtonUpPoint = point;}///////////////////////////////////////////////////////////////////////////
/*$功能:用于绘制放大,缩小的边框$*/
void C3DCityBuilderView::DrawRect(CDC * pdc,CPoint point)
{ CRect rect;
rect.SetRect(LButtonDownPoint.x, LButtonDownPoint.y, m_OldPoint.x, m_OldPoint.y);
if(m_bIsLButtonDown == 100)
{
rect.NormalizeRect();
pdc->DrawFocusRect(&rect);
}
else
m_bIsLButtonDown = 100;
rect.SetRect(LButtonDownPoint.x,LButtonDownPoint.y,point.x,point.y);
rect.NormalizeRect();
pdc->DrawFocusRect(&rect);
m_OldPoint = point;
}