编写MFC下的单文档程序,通过鼠标点击选择两个点,作为矩形左上角,右下角,绘制矩形 10
展开全部
View 类中增加两个变量.CPoint m_ptLeftTop;BOOL m_bHasLeftTop.
LButtonDown处理函数中.
if (m_bHasLeftTop)
{
CDC * pdc;
pdc = this->GetDC();
pdc->Rectangle(m_ptLeftTop.x, m_ptLeftTop.y, pt.x, pt.y);
m_bHasLeftTop = FALSE;
}
else
{
m_ptLefttop = pt;
m_bHasLeftTop = TRUE;
}
LButtonDown处理函数中.
if (m_bHasLeftTop)
{
CDC * pdc;
pdc = this->GetDC();
pdc->Rectangle(m_ptLeftTop.x, m_ptLeftTop.y, pt.x, pt.y);
m_bHasLeftTop = FALSE;
}
else
{
m_ptLefttop = pt;
m_bHasLeftTop = TRUE;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询