本文整理汇总了C++中CDisplay::GetPaperDC方法的典型用法代码示例。如果您正苦于以下问题:C++ CDisplay::GetPaperDC方法的具体用法?C++ CDisplay::GetPaperDC怎么用?C++ CDisplay::GetPaperDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDisplay
的用法示例。
在下文中一共展示了CDisplay::GetPaperDC方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLButtonUp
void CPanTool::OnLButtonUp(_CVIEW* pView, UINT nFlags, CPoint& point)
{
CMiniCADDoc* pDoc = pView->GetDocument();
if (pDoc==NULL)return;
CADGraphics *pGraphics = &pDoc->m_Graphics;
CDisplay *pDisplay = pGraphics->m_pDisplay;
if (pDisplay == NULL) return;
double ddx,ddy;
int dx,dy;
dx = point.x - c_PtDown.x;
dy = point.y - c_PtDown.y;
if (pView->m_curWorkSpace==MODELSPACE)
{
ddx = dx/pDoc->m_Graphics.m_ZoomRate;
ddy = dy/pDoc->m_Graphics.m_ZoomRate;
pDoc->m_Graphics.m_Bound.Offset(-ddx,-ddy);
pView->ReDraw();
}
else
{
CDC* pPaperDC=pDisplay->GetPaperDC();
ddx = dx/pDoc->m_Graphics.m_ZoomRate;
ddy = dy/pDoc->m_Graphics.m_ZoomRate;
pDoc->m_Graphics.m_Bound.Offset(-ddx,-ddy);
CPoint point1;
point1 = pDoc->m_Graphics.DocToClient(pView->m_RotatePt);
pDoc->m_Graphics.RotateAll(pDisplay->GetDC(),point1,-(int)pDoc->m_Graphics.m_RotateAngle);
//pDoc->m_Graphics.DrawGraphics(m_pDisplay->GetDC());
pPaperDC->BitBlt(pView->m_ModelRect.left,pView->m_ModelRect.top,pView->m_ModelRect.Width(),pView->m_ModelRect.Height(),pDisplay->GetDC(),0,0,SRCCOPY);
pView->Invalidate(false);
}
CDrawTool::OnLButtonUp(pView, nFlags, point);
}
示例2: OnMouseMove
void CPanTool::OnMouseMove(_CVIEW* pView, UINT nFlags, CPoint& point)
{
::SetCursor(AfxGetApp()->LoadCursor(IDC_PAN));
CDC* pDC = NULL;
pDC = pView->GetDC();
if (pDC == NULL) return;
CMiniCADDoc* pDoc = pView->GetDocument();
if (pDoc==NULL)return;
CADGraphics *pGraphics = &pDoc->m_Graphics;
CDisplay *pDisplay = pGraphics->m_pDisplay;
if (pDisplay == NULL) return;
if (!c_bDown)
{
DeleteDC(pDC->m_hDC);
return;
}
::SetCursor(AfxGetApp()->LoadCursor(IDC_PANDOWN));
double ddx,ddy;
int dx,dy;
dx=point.x-c_PtOld.x;
dy=point.y-c_PtOld.y;
ddx=dx/pDoc->m_Graphics.m_ZoomRate;
ddy=dy/pDoc->m_Graphics.m_ZoomRate;
int cx = point.x - c_PtDown.x;
int cy = point.y - c_PtDown.y;
CBrush brush;
brush.CreateSolidBrush(pDoc->m_Graphics.m_BKColor);
CRect rect;
CRect rect2;
pView->GetClientRect(rect);
if(pView->m_curWorkSpace==MODELSPACE)
{
if (cx>0)
rect2.SetRect(0,0,cx,rect.Height());
else
rect2.SetRect(rect.Width()+cx,0,rect.Width(),rect.Height());
pDC->FillRect(&rect2, &brush);
if (cy>0)
rect2.SetRect(0,0,rect.Width(),cy-1);
else
rect2.SetRect(0,rect.Height()+cy,rect.Width(),rect.Height());
pDC->FillRect(&rect2, &brush);
pDC->BitBlt(cx,cy,rect.Width(),rect.Height(),pDisplay->GetDC(),0,0,SRCCOPY);
}
else
{
CRect moveRect=pView->m_ModelRect;
CDC* pPaperDC=pDisplay->GetPaperDC();
int xOffset=0;
int yOffset=0;
if (cx>0)
{
if(cx>pView->m_ModelRect.Width())cx=pView->m_ModelRect.Width();
rect2.SetRect(pView->m_ModelRect.left,pView->m_ModelRect.top,pView->m_ModelRect.left+cx,pView->m_ModelRect.top+pView->m_ModelRect.Height());
moveRect.left+=cx;
}
else
{
if(cx<-pView->m_ModelRect.Width())cx=-pView->m_ModelRect.Width();
rect2.SetRect(pView->m_ModelRect.left+pView->m_ModelRect.Width()+cx,pView->m_ModelRect.top,pView->m_ModelRect.left+pView->m_ModelRect.Width(),pView->m_ModelRect.top+pView->m_ModelRect.Height());
moveRect.right+=cx;
xOffset-=cx;
}
pPaperDC->FillRect(&rect2, &brush);
if (cy>0)
{
if(cy>pView->m_ModelRect.Height())cy=pView->m_ModelRect.Height();
rect2.SetRect(pView->m_ModelRect.left,pView->m_ModelRect.top,pView->m_ModelRect.left+pView->m_ModelRect.Width(),pView->m_ModelRect.top+cy);
moveRect.top+=cy;
}
else
{
if(cy<-pView->m_ModelRect.Height())cy=-pView->m_ModelRect.Height();
rect2.SetRect(pView->m_ModelRect.left,pView->m_ModelRect.top+pView->m_ModelRect.Height()+cy,pView->m_ModelRect.left+pView->m_ModelRect.Width(),pView->m_ModelRect.top+pView->m_ModelRect.Height());
moveRect.bottom+=cy;
yOffset-=cy;
}
pPaperDC->FillRect(&rect2, &brush);
pPaperDC->BitBlt(moveRect.left,moveRect.top,moveRect.Width(),moveRect.Height(),pDisplay->GetDC(),xOffset,yOffset,SRCCOPY);
pView->Invalidate(false);
}
brush.DeleteObject();
DeleteDC(pDC->m_hDC);
CDrawTool::OnMouseMove(pView, nFlags, point);
}