Click here to Skip to main content
15,915,093 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaldrawing to a bitmap in memory Pin
Member 151798010-Dec-04 4:14
Member 151798010-Dec-04 4:14 
GeneralRe: drawing to a bitmap in memory Pin
Andy Hunter10-Dec-04 10:42
Andy Hunter10-Dec-04 10:42 
Questiondoes OnCtlColor work for buttons? Pin
zoid ! 10-Dec-04 4:10
zoid ! 10-Dec-04 4:10 
AnswerRe: does OnCtlColor work for buttons? Pin
G. Steudtel10-Dec-04 6:40
G. Steudtel10-Dec-04 6:40 
GeneralRe: does OnCtlColor work for buttons? Pin
prcarp10-Dec-04 7:12
prcarp10-Dec-04 7:12 
GeneralWindows Forms not available Pin
User 58261910-Dec-04 3:44
User 58261910-Dec-04 3:44 
GeneralRe: Windows Forms not available Pin
BlackDice10-Dec-04 9:50
BlackDice10-Dec-04 9:50 
GeneralScaleViewportExt and SetViewOrg related query Pin
JHAKAS10-Dec-04 3:40
JHAKAS10-Dec-04 3:40 
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) <br />
{<br />
	<br />
if ((m_Mode == MODE_ANALYSIS && m_AnalysisItem == AN_TIME_WINDOW) || <br />
    (m_Mode == MODE_ANALYSIS && m_AnalysisItem == AN_WFR_DIAGRAM))<br />
   {<br />
          QZoomView::OnPrepareDC(pDC, pInfo);		<br />
   }<br />
   else<br />
   {<br />
          CScrollView::OnPrepareDC (pDC,pInfo);<br />
          pDC->SetMapMode(MM_LOENGLISH);		<br />
   }<br />
}


And OnPrepareDC of QZoomView


Code:
void QZoomView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)<br />
{<br />
  CScrollView::OnPrepareDC(pDC, pInfo);<br />
  if (!pDC->IsPrinting())<br />
  {<br />
	ASSERT(m_Zoom > 0.0f);<br />
	int denom(1000);  // WHAT IS THIS?<br />
	int num((int)(m_Zoom * (float)denom));<br />
                pDC->SetMapMode(MM_ANISOTROPIC);<br />
	pDC->ScaleViewportExt(num, denom, num, denom);<br />
		<br />
	CRect rect;<br />
	GetClientRect(&rect);<br />
	CPoint pntVO = pDC->GetViewportOrg();<br />
	// Center in window if small enough<br />
	if (m_totalDev.cx < rect.Width())<br />
		pntVO.x = (rect.Width() - m_totalDev.cx) / 2;<br />
	if (m_totalDev.cy < rect.Height())<br />
		pntVO.y = (rect.Height() - m_totalDev.cy) / 2;<br />
	pDC->SetViewportOrg(pntVO);<br />
   }<br />
}

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
GeneralRe: ScaleViewportExt and SetViewOrg related query Pin
JHAKAS10-Dec-04 20:08
JHAKAS10-Dec-04 20:08 
GeneralSDI, MDI or dialog based Pin
help_cplus10-Dec-04 3:31
help_cplus10-Dec-04 3:31 
GeneralRe: SDI, MDI or dialog based Pin
Maximilien10-Dec-04 3:46
Maximilien10-Dec-04 3:46 
GeneralRe: SDI, MDI or dialog based Pin
help_cplus11-Dec-04 12:25
help_cplus11-Dec-04 12:25 
Generalreturning CMap object Pin
Tariq87810-Dec-04 1:55
Tariq87810-Dec-04 1:55 
GeneralRe: returning CMap object Pin
Antti Keskinen10-Dec-04 3:12
Antti Keskinen10-Dec-04 3:12 
GeneralRe: returning CMap object Pin
Cedric Moonen10-Dec-04 4:11
Cedric Moonen10-Dec-04 4:11 
GeneralRe: returning CMap object Pin
Antti Keskinen10-Dec-04 4:44
Antti Keskinen10-Dec-04 4:44 
GeneralRe: returning CMap object Pin
Cedric Moonen10-Dec-04 5:10
Cedric Moonen10-Dec-04 5:10 
GeneralCListCtrl Text Color Pin
Neelesh K J Jain10-Dec-04 1:19
Neelesh K J Jain10-Dec-04 1:19 
GeneralRe: CListCtrl Text Color Pin
Jim Crafton10-Dec-04 6:38
Jim Crafton10-Dec-04 6:38 
Generalserial com / usb Pin
doneirik10-Dec-04 1:16
doneirik10-Dec-04 1:16 
GeneralRe: serial com / usb Pin
Cedric Moonen10-Dec-04 1:27
Cedric Moonen10-Dec-04 1:27 
GeneralRe: serial com / usb Pin
doneirik10-Dec-04 3:10
doneirik10-Dec-04 3:10 
GeneralRe: serial com / usb Pin
Antti Keskinen10-Dec-04 4:07
Antti Keskinen10-Dec-04 4:07 
GeneralRe: serial com / usb Pin
Trollslayer10-Dec-04 5:23
mentorTrollslayer10-Dec-04 5:23 
GeneralRe: serial com / usb Pin
doneirik13-Dec-04 1:37
doneirik13-Dec-04 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.