ScaleViewportExt and SetViewOrg related query
-
Hi all I am facing problem with the following issues: 1.0 Mapping Mode 2.0 ScaleViewport 3.0 SetViewOrg. I am using QZoomView a class from Codeguru as base class of my view which inturn is derived from CScrollView Following is the OnPrepareDC function of the My View Code:
void CPatternView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { if ((m_Mode == MODE_ANALYSIS && m_AnalysisItem == AN_TIME_WINDOW) || (m_Mode == MODE_ANALYSIS && m_AnalysisItem == AN_WFR_DIAGRAM)) { QZoomView::OnPrepareDC(pDC, pInfo); } else { CScrollView::OnPrepareDC (pDC,pInfo); pDC->SetMapMode(MM_LOENGLISH); } }
And OnPrepareDC of QZoomView Code:void QZoomView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { CScrollView::OnPrepareDC(pDC, pInfo); if (!pDC->IsPrinting()) { ASSERT(m_Zoom > 0.0f); int denom(1000); // WHAT IS THIS? int num((int)(m_Zoom * (float)denom)); pDC->SetMapMode(MM_ANISOTROPIC); pDC->ScaleViewportExt(num, denom, num, denom); CRect rect; GetClientRect(&rect); CPoint pntVO = pDC->GetViewportOrg(); // Center in window if small enough if (m_totalDev.cx < rect.Width()) pntVO.x = (rect.Width() - m_totalDev.cx) / 2; if (m_totalDev.cy < rect.Height()) pntVO.y = (rect.Height() - m_totalDev.cy) / 2; pDC->SetViewportOrg(pntVO); } }
PROBLEM STATEMENT This indicates that when I am calling QZoomView::OnPrepareDC then it changes the view settings and then if i am using onpreparedc of CScrollview then content of my view get displaced/shifted horizontally. I just want to get the view in initial position i.e. the effect of changes made by QZoomView::OnPrepareDC get neglected. Can you please help me in getting this done? Sandeep Leave your mark wherever you go -
Hi all I am facing problem with the following issues: 1.0 Mapping Mode 2.0 ScaleViewport 3.0 SetViewOrg. I am using QZoomView a class from Codeguru as base class of my view which inturn is derived from CScrollView Following is the OnPrepareDC function of the My View Code:
void CPatternView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { if ((m_Mode == MODE_ANALYSIS && m_AnalysisItem == AN_TIME_WINDOW) || (m_Mode == MODE_ANALYSIS && m_AnalysisItem == AN_WFR_DIAGRAM)) { QZoomView::OnPrepareDC(pDC, pInfo); } else { CScrollView::OnPrepareDC (pDC,pInfo); pDC->SetMapMode(MM_LOENGLISH); } }
And OnPrepareDC of QZoomView Code:void QZoomView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) { CScrollView::OnPrepareDC(pDC, pInfo); if (!pDC->IsPrinting()) { ASSERT(m_Zoom > 0.0f); int denom(1000); // WHAT IS THIS? int num((int)(m_Zoom * (float)denom)); pDC->SetMapMode(MM_ANISOTROPIC); pDC->ScaleViewportExt(num, denom, num, denom); CRect rect; GetClientRect(&rect); CPoint pntVO = pDC->GetViewportOrg(); // Center in window if small enough if (m_totalDev.cx < rect.Width()) pntVO.x = (rect.Width() - m_totalDev.cx) / 2; if (m_totalDev.cy < rect.Height()) pntVO.y = (rect.Height() - m_totalDev.cy) / 2; pDC->SetViewportOrg(pntVO); } }
PROBLEM STATEMENT This indicates that when I am calling QZoomView::OnPrepareDC then it changes the view settings and then if i am using onpreparedc of CScrollview then content of my view get displaced/shifted horizontally. I just want to get the view in initial position i.e. the effect of changes made by QZoomView::OnPrepareDC get neglected. Can you please help me in getting this done? Sandeep Leave your mark wherever you go