
一个mfc的程序 划线 初学mfc 所以不是太懂望谅解
建立一个叫gag的mfc工程后只是做了一下改变只是在标注汉子的地方是自己写的代码,别的没变,问题出在哪,怎么不能画?由于字数有限制所以只是把自己写的复制过来了//////...
建立一个叫gag的mfc工程后只是做了一下改变 只是在标注汉子的地方是自己写的代码,别的没变,问题出在哪,怎么不能画?由于字数有限制所以只是把自己写的复制过来了
/////////////////////////////////////////////////////////////////////////////
// CGagView construction/destruction
CGagView::CGagView()/////////////////////////////////////////////////////构造的一个点构造的一个点构造的一个点构造的一个点构造的一个点/
{
// TODO: add construction code here
N_point=0;
}
CGagView::~CGagView()
{
}
void CGagView::OnLButtonDown(UINT nFlags, CPoint point) ////////////////保存点 保存点 保存点 保存点保存点保存点保存点保存点
{
// TODO: Add your message handler code here and/or call default
N_point=point;
// MessageBox("hjfhdkj");
CView::OnLButtonDown(nFlags, point);
}
void CGagView::OnLButtonUp(UINT nFlags, CPoint point) ////////////用hdc划线 用hdc划线 用hdc划线 用hdc划线 用hdc划线 用hdc划线
{
// TODO: Add your message handler code here and/or call default
HDC hdc;
hdc=::GetDC(m_hWnd);
MoveToEx(hdc,N_point.x,N_point.y,NULL);
LineTo(hdc,N_point.x,N_point.y);
::ReleaseDC(m_hWnd,hdc);
CView::OnLButtonUp(nFlags, point);
}
void CGagView::OnCaptureChanged(CWnd *pWnd)
{
// TODO: Add your message handler code here
CView::OnCaptureChanged(pWnd);
} 展开
/////////////////////////////////////////////////////////////////////////////
// CGagView construction/destruction
CGagView::CGagView()/////////////////////////////////////////////////////构造的一个点构造的一个点构造的一个点构造的一个点构造的一个点/
{
// TODO: add construction code here
N_point=0;
}
CGagView::~CGagView()
{
}
void CGagView::OnLButtonDown(UINT nFlags, CPoint point) ////////////////保存点 保存点 保存点 保存点保存点保存点保存点保存点
{
// TODO: Add your message handler code here and/or call default
N_point=point;
// MessageBox("hjfhdkj");
CView::OnLButtonDown(nFlags, point);
}
void CGagView::OnLButtonUp(UINT nFlags, CPoint point) ////////////用hdc划线 用hdc划线 用hdc划线 用hdc划线 用hdc划线 用hdc划线
{
// TODO: Add your message handler code here and/or call default
HDC hdc;
hdc=::GetDC(m_hWnd);
MoveToEx(hdc,N_point.x,N_point.y,NULL);
LineTo(hdc,N_point.x,N_point.y);
::ReleaseDC(m_hWnd,hdc);
CView::OnLButtonUp(nFlags, point);
}
void CGagView::OnCaptureChanged(CWnd *pWnd)
{
// TODO: Add your message handler code here
CView::OnCaptureChanged(pWnd);
} 展开
3个回答
展开全部
MoveToEx(hdc,N_point.x,N_point.y,NULL);
LineTo(hdc,N_point.x,N_point.y);
改为:
MoveToEx(hdc,N_point.x,N_point.y,NULL);
LineTo(hdc,point.x,point.y);
LineTo(hdc,N_point.x,N_point.y);
改为:
MoveToEx(hdc,N_point.x,N_point.y,NULL);
LineTo(hdc,point.x,point.y);
展开全部
void CGagView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC *pDC = GetDC();//mfc下直接用MFC的东西
pDC->MoveTo(N_point);
pDC->LineTo(point);//你的程序中,两个点重复了,划不出来线,只是一个点
CView::OnLButtonUp(nFlags, point);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
放在onpaint里
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询