下载本文示例代码
就象画笔中拖动鼠标,画出一个矩形,该区域被选择。有没有现成的例子?我给你一个:年轻的时候写的,有些变量的意义自己想吧,我记不得了。
void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
{
if (!isrect) {
startpoint=point;
temppoint=point;
flags=TRUE;
}
CView::OnLButtonDown(nFlags, point);
}
void CMyView::OnLButtonUp(UINT nFlags, CPoint point)
{
flags=FALSE;
CView::OnLButtonUp(nFlags, point);
}
void CMyView::OnMouseMove(UINT nFlags, CPoint point)
{
if (flags) {
CDC *pDC=GetDC();
CRect rect(startpoint.x, startpoint.y, temppoint.x, temppoin
t.y);
rect.NormalizeRect();
pDC->DrawFocusRect(rect);
rect.SetRect(startpoint.x, startpoint.y, point.x, point.y);
rect.NormalizeRect();
pDC->DrawFocusRect(rect);
temppoint=point;
isrect=TRUE;
ReleaseDC(pDC);
}
CView::OnMouseMove(nFlags, point);
}
void CMyView::OnRButtonUp(UINT nFlags, CPoint point)
{
if(isrect) {
CDC *pDC=GetDC();
CRect rect(startpoint.x, startpoint.y, temppoint.x, temppoin
t.y);
rect.NormalizeRect();
pDC->DrawFocusRect(rect);
ReleaseDC(pDC);
isrect=FALSE;
}
CView::OnRButtonUp(nFlags, point);
}
就象画笔中拖动鼠标,画出一个矩形,该区域被选择。有没有现成的例子?我给你一个:年轻的时候写的,有些变量的意义自己想吧,我记不得了。
void CMyView::OnLButtonDown(UINT nFlags, CPoint point)
{
if (!isrect) {
startpoint=point;
temppoint=point;
flags=TRUE;
}
CView::OnLButtonDown(nFlags, point);
}
void CMyView::OnLButtonUp(UINT nFlags, CPoint point)
{
flags=FALSE;
CView::OnLButtonUp(nFlags, point);
}
void CMyView::OnMouseMove(UINT nFlags, CPoint point)
{
if (flags) {
CDC *pDC=GetDC();
CRect rect(startpoint.x, startpoint.y, temppoint.x, temppoin
t.y);
rect.NormalizeRect();
pDC->DrawFocusRect(rect);
rect.SetRect(startpoint.x, startpoint.y, point.x, point.y);
rect.NormalizeRect();
pDC->DrawFocusRect(rect);
temppoint=point;
isrect=TRUE;
ReleaseDC(pDC);
}
CView::OnMouseMove(nFlags, point);
}
void CMyView::OnRButtonUp(UINT nFlags, CPoint point)
{
if(isrect) {
CDC *pDC=GetDC();
CRect rect(startpoint.x, startpoint.y, temppoint.x, temppoin
t.y);
rect.NormalizeRect();
pDC->DrawFocusRect(rect);
ReleaseDC(pDC);
isrect=FALSE;
}
CView::OnRButtonUp(nFlags, point);
}
下载本文示例代码
选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法选择一块区域的实现方法
阅读(167) | 评论(0) | 转发(0) |