Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ScaleViewportExt and SetViewOrg related query

ScaleViewportExt and SetViewOrg related query

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiondatabase
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JHAKAS
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • J JHAKAS

      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

      J Offline
      J Offline
      JHAKAS
      wrote on last edited by
      #2

      Any suggestions Leave your mark wherever you go

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups