void NFrameBase::Draw(NRender* render, Base::NPoint& ptOffset, HRGN clipRgn) { if(!IsVisible()) return; Base::NRect rect(frameRect_); rect.Offset(ptOffset.X, ptOffset.Y); if(!::RectInRegion(clipRgn, rect)) return; NRenderClip clip(render, clipRgn, rect); if(clip.IsEmpty()) return; PreDrawEvent.Invoke(this, NULL); DrawBkg(render, rect); rect.Left += padding_.Left; rect.Top += padding_.Top; rect.Right -= padding_.Right; rect.Bottom -= padding_.Bottom; DrawContent(render, rect); DrawFore(render, rect); DrawChilds(render, ptOffset, clipRgn); }
void NFrameBase::Draw(NRender* render, Base::NPoint& ptOffset, HRGN clipRgn) { if(!IsVisible() || !IsValid()) return; Base::NRect rect(frameRect_); rect.Offset(ptOffset.X, ptOffset.Y); if(!::RectInRegion(clipRgn, rect)) return; NRenderClip clip(render, clipRgn, rect); DrawBkg(render, rect); DrawContent(render, rect); DrawFore(render, rect); DrawChilds(render, ptOffset, clipRgn); }
void CEditPrevWnd::OnMouseMove(UINT nFlags, CPoint point) { if(!m_bCropPress) { if(m_bMoveEnabled) { m_ptChanged = point - m_ptMoveStart; m_ptMoveStart = point; if(!m_bMoveFore) { if(m_ptChanged != CPoint(0,0)) PointContrast(); } else //move fore image { CSize sz(0,0); sz = CSize((LONG)(m_ptChanged.x/m_dScaling), (LONG)(m_ptChanged.y/m_dScaling)); if(sz != CSize(0,0)) { (((CPhotoEditDlg*)m_pParentWnd)->GetCurObject())->MoveForeImage(sz); ((CPhotoEditDlg*)m_pParentWnd)->SetCurImageModified(true); CDC* pDC = GetDC(); DrawFore(pDC); ReleaseDC(pDC); } } } else { ::SetCursor(::AfxGetApp()->LoadCursor(IDC_CURSOR_HAND_ON)); } } else { if(((CPhotoEditDlg*)m_pParentWnd)->GetEditType() == EDIT_RESIZE) { if(!m_rtImageRect.PtInRect(point)) return; ::SetCursor(::AfxGetApp()->LoadStandardCursor(IDC_CROSS)); { if((nFlags & MK_LBUTTON) == MK_LBUTTON)//&&(m_rtImageRect.PtInRect(m_OldPoint))) { if(m_bAfterCrop) { Invalidate(); m_bAfterCrop = FALSE; } CDC * pDC = GetDC(); CRect rtOld; if(m_OldPoint.x < m_rtImageRect.left) m_OldPoint.x = m_rtImageRect.left; if (m_OldPoint.x > m_rtImageRect.right) m_OldPoint.x = m_rtImageRect.right; if(m_OldPoint.y < m_rtImageRect.top) m_OldPoint.y = m_rtImageRect.top; if (m_OldPoint.y > m_rtImageRect.bottom) m_OldPoint.y = m_rtImageRect.bottom; int x1 = m_OldPoint.x; int y1 = m_OldPoint.y; int x2 = m_PrePoint.x; int y2 = m_PrePoint.y; rtOld.left = min(x1,x2); rtOld.top = min(y1,y2); rtOld.right = max(x1,x2); rtOld.bottom = max(y1,y2); DrawRect(pDC,rtOld); if(point.x < m_rtImageRect.left) point.x = m_rtImageRect.left; if (point.x > m_rtImageRect.right) point.x = m_rtImageRect.right; if(point.y < m_rtImageRect.top) point.y = m_rtImageRect.top; if (point.y > m_rtImageRect.bottom) point.y = m_rtImageRect.bottom; m_PrePoint = point; CRect rtNew; x1 = m_OldPoint.x; y1 = m_OldPoint.y; x2 = point.x; y2 = point.y; rtNew.left = min(x1,x2); rtNew.top = min(y1,y2); rtNew.right = max(x1,x2); rtNew.bottom = max(y1,y2); m_rtPreRect = rtNew; DrawRect(pDC,m_rtPreRect); m_bRectExist = TRUE; //Draw(pDC); ReleaseDC(pDC); } } } } CWnd::OnMouseMove(nFlags, point); }