15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Mixing Portrait and Landscape in Standard Print and Print Pr

Mats Mеnhav -- manhav@connectum.skurup.se
Wednesday, October 09, 1996

-- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --

Environment: MSVC 4.2 Win NT 4.0/Win 95
Hi,

In my application I want to print several pages. 
I will ignore the setting of Landscape/Portrait for some of these pages and
always print them in Landscape mode. 

Is it possible to use the standard print loop of MFC and mix landscape and
portrait ?
I.e is it possible to set one page in landscape so that the CPrintInfo::
m_rectDraw is adjusted for this in one page, and have another page in
Portrait and have CPrintInfo::m_rectDraw adjusted to that.

What about the Print Preview in MFC ? Is it at all possible to have the
Print Preview show some page in Portrait mode and other in Landscape mode ? 

Or is the only solution to make my own print and preview loops for this ?

Mats

--
==========================================================================
Mats Mеnhav (Mats Manhav for 7-bit people)
email:manhav@connectum.skurup.se   WWW: http://connectum.skurup.se/~manhav
FAX:  (int) 46 (0) 414 243 05      Phone: (int) 46 (0) 414 243 05         
==========================================================================




LeRoy Baxter -- lbaxter@transport.com
Thursday, October 10, 1996

[Mini-digest: 4 responses]

Yes, you definitely can.  Check out the CDC::StartPage() and CDC::ResetDC()
for a start.  If you can't get going, perhaps I can find some source code.

On Wednesday, October 09, 1996 9:29 PM, Mats Manhav[SMTP:manhav@connectum.skurup.se] wrote:
>-- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --
>
>Environment: MSVC 4.2 Win NT 4.0/Win 95
>Hi,
>
>In my application I want to print several pages. 
>I will ignore the setting of Landscape/Portrait for some of these pages and
>always print them in Landscape mode. 
>
>Is it possible to use the standard print loop of MFC and mix landscape and
>portrait ?
>I.e is it possible to set one page in landscape so that the CPrintInfo::
>m_rectDraw is adjusted for this in one page, and have another page in
>Portrait and have CPrintInfo::m_rectDraw adjusted to that.
>
>What about the Print Preview in MFC ? Is it at all possible to have the
>Print Preview show some page in Portrait mode and other in Landscape mode ? 
>
>Or is the only solution to make my own print and preview loops for this ?
>
>Mats
>
>--
>==========================================================================
>Mats Manhav (Mats Manhav for 7-bit people)
>email:manhav@connectum.skurup.se   WWW: http://connectum.skurup.se/~manhav
>FAX:  (int) 46 (0) 414 243 05      Phone: (int) 46 (0) 414 243 05         
>==========================================================================
>
>


-----From: David Little 

It might be easier to create a font that is rotated and print that =
way.... I am not sure, but I think that it is the third parameter of =
CFont::CreateFont, or the nOrientation member of the font structure....

-----From: "C.Zhang" 

The answer is YES because I am doing it.

Checkout the funcion ResetDC and OnPrepareDC.

> What about the Print Preview in MFC ? Is it at all possible to have the
> Print Preview show some page in Portrait mode and other in Landscape mo=
de ?
>=20
> Or is the only solution to make my own print and preview loops for this=
 ?

You probably have to redo the CPreviewView not only the loop.

-----From: "Jim Schollenberger" 

You could test for the page number in OnPrepareDC, and switch 
the mode appropriately.  Something like this should work for both
printing and print preview:

Good Luck,
Jim Schollenberger
=================================================================
void CTCMView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{
	CView::OnPrepareDC(pDC, pInfo);
	
	PRINTDLG* pPrintDlg = new PRINTDLG;
	AfxGetApp()->GetPrinterDeviceDefaults(pPrintDlg);
	DEVMODE* lpDevMode = (DEVMODE*)::GlobalLock(pPrintDlg->hDevMode);
		
	// Test for page number to see if it should be in portrait mode.
	switch(pInfo->m_nCurPage)
	{
	case 1:	// Set page 1 and 3 to portrait mode.
	case 3:
		lpDevMode->dmOrientation = DMORIENT_PORTRAIT;
		break;
			
	default:	// Default printing is landscape
		lpDevMode->dmOrientation = DMORIENT_LANDSCAPE;
		break;
	}
	pDC->ResetDC(lpDevMode);
	::GlobalUnlock(pPrintDlg->hDevMode);
	delete pPrintDlg;
		
		etc.		






| Вернуться в корень Архива |