void CsingledocView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
m_ptOrigin=point;
CView::OnLButtonDown(nFlags, point);
}void CsingledocView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值 CClientDC dc(this);
CBrush *brush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
CBrush *m_Oldbrush=dc.SelectObject(brush);
dc.Rectangle(CRect(m_ptOrigin,point));
dc.SelectObject(m_Oldbrush);
CView::OnLButtonUp(nFlags, point);
}
以上可以实现透明画刷的功能,但是红色部分代码换成:dc.FillRect(CRect(m_ptOrigin,point),brush);运行时,拖动鼠标后怎么什么都没有呢???按说可以有同样的效果呀!哪位大侠指导下哈!
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
m_ptOrigin=point;
CView::OnLButtonDown(nFlags, point);
}void CsingledocView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值 CClientDC dc(this);
CBrush *brush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
CBrush *m_Oldbrush=dc.SelectObject(brush);
dc.Rectangle(CRect(m_ptOrigin,point));
dc.SelectObject(m_Oldbrush);
CView::OnLButtonUp(nFlags, point);
}
以上可以实现透明画刷的功能,但是红色部分代码换成:dc.FillRect(CRect(m_ptOrigin,point),brush);运行时,拖动鼠标后怎么什么都没有呢???按说可以有同样的效果呀!哪位大侠指导下哈!
Draws a rectangle using the current pen. The interior of the rectangle is filled using the current brush. Rectangle边框是用的pen,内部用的brush而FillRect只用Brush吧,所以什么也没有