(5)鼠标弹起函数
void CRectGraph::RectLButtonUp(UINT nFlags, CPoint point)
{
RectCoordinateReversal();
DrawXorRect(0,0,RGB(255,0,0));
m_bIsDraw = FALSE;
m_pView->Invalidate();
}
(6)鼠标移动函数
void CRectGraph::RectMouseMove(UINT nFlags, CPoint point)
{
RectAddCurResourse(point);
if(!m_bIsDraw) return;
DrawXorRect(0,0,RGB(255,0,0));
SetCurRect(point);
DrawXorRect(0,0,RGB(255,0,0));
m_pntPrev = point;
}
4.2 辅助功能函数
(1)判断点的位置是在矩形框的什么位置函数
long CRectGraph::JudgePositionInRect (CPoint point)
{
long lRslt = SUBWIN_OUT;//在右下
CRect inRect,upRect,downRect,leftRect,rightRect;
CRect leftupRect,rightupRect,leftdownRect,rightdownRect;
inRect.left = m_Rect.left+8; inRect.top = m_Rect.top+8;
inRect.right = m_Rect.right-8; inRect.bottom = m_Rect.bottom-8;
downRect.left = m_Rect.left+8; downRect.top = m_Rect.bottom-8;
downRect.right = m_Rect.right-8; downRect.bottom = m_Rect.bottom+8;
upRect.left = m_Rect.left+8; upRect.top = m_Rect.top-8;
upRect.right = m_Rect.right-8; upRect.bottom = m_Rect.top+8;
leftRect.left = m_Rect.left-8; leftRect.top = m_Rect.top+8;
leftRect.right = m_Rect.left+8; leftRect.bottom = m_Rect.bottom-8;
rightRect.left = m_Rect.right-8; rightRect.top = m_Rect.top+8;
rightRect.right = m_Rect.right+8; rightRect.bottom = m_Rect.bottom-8;
leftupRect.left = m_Rect.left-8; leftupRect.top = m_Rect.top-8;
leftupRect.right =m_Rect.left+8 ; leftupRect.bottom = m_Rect.top+8;
rightupRect.left = m_Rect.right-8; rightupRect.top = m_Rect.top-8;
rightupRect.right = m_Rect.right+8; rightupRect.bottom = m_Rect.top+8;
leftdownRect.left = m_Rect.left-8; leftdownRect.top = m_Rect.bottom-8; leftdownRect.right = m_Rect.left+8; leftdownRect.bottom = m_Rect.bottom+8;
|