Click here to Skip to main content
16,010,876 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: click into view of a website return the content of it Pin
22491711-Jan-05 0:55
22491711-Jan-05 0:55 
GeneralRe: click into view of a website return the content of it Pin
rising_sun_200511-Jan-05 4:31
rising_sun_200511-Jan-05 4:31 
GeneralOverwrite contents of a file Pin
dlarkin7710-Jan-05 9:19
dlarkin7710-Jan-05 9:19 
GeneralRe: Overwrite contents of a file Pin
Shog910-Jan-05 9:33
sitebuilderShog910-Jan-05 9:33 
GeneralRe: Overwrite contents of a file Pin
dlarkin7710-Jan-05 10:25
dlarkin7710-Jan-05 10:25 
GeneralRe: Overwrite contents of a file Pin
Jörgen Sigvardsson10-Jan-05 13:18
Jörgen Sigvardsson10-Jan-05 13:18 
GeneralRe: Overwrite contents of a file Pin
gecool10-Jan-05 22:48
gecool10-Jan-05 22:48 
GeneralPrint Preview Pin
act_x10-Jan-05 7:53
act_x10-Jan-05 7:53 
For my setup , it is not WYSIWYG in the View . I do not know the number of pages for printing beforeHand . Basically I need to print out the contents of a Grid Control

I am overriding
1)OnPrepareDC (basically enables/disables continuing of printing)
that checks for the current Row( being printed out.
The code looks like this
void NewView1::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) <br />
{<br />
	// TODO: Add your specialized code here and/or call the base class<br />
<br />
	TRACE("Called OnPrepareDC\n");<br />
	if(pInfo && printRowId>=m_grid.intf->RowCount){<br />
		TRACE("FALSE\n");<br />
	<br />
		pInfo->m_bContinuePrinting=false;<br />
		printRowId =0;<br />
	}<br />
	else{<br />
		TRACE("TRUE\n");<br />
			CFormView::OnPrepareDC(pDC, pInfo);	<br />
		if(pInfo)<br />
		pInfo->m_bContinuePrinting=true;<br />
	<br />
	}<br />
	<br />
}


and

2)OnPrint
<br />
void NewView1::OnPrint(CDC* pDC, CPrintInfo* pInfo) <br />
{	TEXTMETRIC tm;<br />
	pDC->GetTextMetrics(&tm);<br />
	string data;<br />
	<br />
        elapsed = printRowId;<br />
	if(printRowId==0){<br />
		data=m_grid.intf->Caption;<br />
		pDC->TextOut(pInfo->m_rectDraw.left,pInfo->m_rectDraw.top+tm.tmHeight,data.c_str());<br />
	}	<br />
	while(printRowId<m_grid.intf->RowCount && printRowId>=0){<br />
		// print each row <br />
		for(int j=0;j<17;j++){<br />
			IsgCellPtr cell = m_grid.intf->GetCellAt(printRowId,j);<br />
			data = cell->GetText();<br />
			pDC->SetBkColor(cell->Style->GetBackColor());<br />
		<br />
			int x=((j-1)*2+5)*tm.tmMaxCharWidth;<br />
			if(j==0)<br />
				x=0;<br />
			pDC->TextOut(pInfo->m_rectDraw.left+x,pInfo->m_rectDraw.top+(printRowId+3)*tm.tmHeight,data.c_str());	<br />
			pDC->UpdateColors();<br />
		<br />
		}<br />
		printRowId++;<br />
		elapsed = printRowID-elapsed ; <br />
	<br />
	CFormView::OnPrint(pDC, pInfo);<br />
}



Now when I select the Print Preview it renders ok in the Print Preview Dialog , but when i click to zoom into it it displays a blank page .

I think that its a logical error where I am not able to trap the action of Zooming so that the code understands that the whole document needs to be printed again .

Where can I trap that ?

Engineering is the effort !
GeneralAccessing/ updating document data in a separate class Pin
help_wanted10-Jan-05 7:11
help_wanted10-Jan-05 7:11 
GeneralRe: Accessing/ updating document data in a separate class Pin
act_x10-Jan-05 8:07
act_x10-Jan-05 8:07 
GeneralRe: Accessing/ updating document data in a separate class Pin
help_wanted10-Jan-05 8:37
help_wanted10-Jan-05 8:37 
GeneralRe: Accessing/ updating document data in a separate class Pin
Iain Clarke, Warrior Programmer10-Jan-05 8:21
Iain Clarke, Warrior Programmer10-Jan-05 8:21 
GeneralRe: Accessing/ updating document data in a separate class Pin
help_wanted10-Jan-05 8:36
help_wanted10-Jan-05 8:36 
GeneralRe: Accessing/ updating document data in a separate class Pin
Iain Clarke, Warrior Programmer10-Jan-05 9:50
Iain Clarke, Warrior Programmer10-Jan-05 9:50 
GeneralFileTimeToSystemTime question Pin
Shay Harel10-Jan-05 7:00
Shay Harel10-Jan-05 7:00 
GeneralRe: FileTimeToSystemTime question Pin
basementman10-Jan-05 7:21
basementman10-Jan-05 7:21 
GeneralRe: FileTimeToSystemTime question Pin
Shay Harel10-Jan-05 8:57
Shay Harel10-Jan-05 8:57 
GeneralConversion class Pin
Renjith Ramachandran10-Jan-05 6:43
Renjith Ramachandran10-Jan-05 6:43 
GeneralRe: Conversion class Pin
act_x10-Jan-05 8:03
act_x10-Jan-05 8:03 
GeneralRe: Conversion class Pin
PJ Arends10-Jan-05 8:44
professionalPJ Arends10-Jan-05 8:44 
GeneralRe: Conversion class Pin
David Crow11-Jan-05 10:31
David Crow11-Jan-05 10:31 
GeneralTAO Corba (Visual Studio) Pin
sweep12310-Jan-05 6:22
sweep12310-Jan-05 6:22 
GeneralProblem with XP! Pin
Lazzari Patrizio10-Jan-05 5:50
Lazzari Patrizio10-Jan-05 5:50 
GeneralRe: Problem with XP! Pin
Iain Clarke, Warrior Programmer10-Jan-05 8:26
Iain Clarke, Warrior Programmer10-Jan-05 8:26 
GeneralRe: Problem with XP! Pin
Lazzari Patrizio10-Jan-05 21:00
Lazzari Patrizio10-Jan-05 21:00 

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.