print preview
-
i have a CDialog ,1 button for print i have a print but i need a button for print preview !How i have read all codeproject stuf but nothing ... this is my code for print : CPrintDialog dlgPrint(FALSE,PD_ALLPAGES,this); if (dlgPrint.DoModal()==IDOK) { // ** Attach the printer DC from the dialog // ** to a CDC object CDC dcPrint; dcPrint.Attach(dlgPrint.GetPrinterDC()); // ** Create and fill a DOCINFO structure DOCINFO myPrintJob; myPrintJob.cbSize = sizeof(myPrintJob); myPrintJob.lpszDocName = "MyPrintJob"; myPrintJob.lpszOutput = NULL; myPrintJob.lpszDatatype = NULL; myPrintJob.fwType = NULL; // ** Start the printing document if (dcPrint.StartDoc(&myPrintJob)>=0) { // ** Start a page dcPrint.StartPage(); CString sQuestion; m_question.GetWindowText(sQuestion); CString sText; sText = "Command"; CString sText1; sText1 = "Display :"; //////////////////////////////////////////////////////////////////////////////////////// dcPrint.TextOut(2000,350,sText); dcPrint.TextOut(300,500,sText1); // ** Throw the page dcPrint.EndPage(); // ** Close the document dcPrint.EndDoc(); } // ** Delete the printer device context dcPrint.DeleteDC(); }
Bravoone
-
No i need something more easy...is to hard for me !you see my code for print ?! i need something like that ...easy not so complicate !can you help me ?!
Bravoone
-
No i need something more easy...is to hard for me !you see my code for print ?! i need something like that ...easy not so complicate !can you help me ?!
Bravoone
some times ago (I think two years ago) I had this problem I wanted to have a preview before print so I explain for you but before it(you can also use of printer driver if you dont have a real printer or dont access to it see this thread[^] ) I calculate dimension for pages like A4,A3,... and convert to screen and then use of a handle to display device context (hdc) sent my datas with BitBlt to screen and it worked and finaly sent my datas to printer like this PRINTDLG pd; ... m_Image.BitBlt(pd.hDC,100,134,640,480,0,0,SRCCOPY);
WhiteSky
-
some times ago (I think two years ago) I had this problem I wanted to have a preview before print so I explain for you but before it(you can also use of printer driver if you dont have a real printer or dont access to it see this thread[^] ) I calculate dimension for pages like A4,A3,... and convert to screen and then use of a handle to display device context (hdc) sent my datas with BitBlt to screen and it worked and finaly sent my datas to printer like this PRINTDLG pd; ... m_Image.BitBlt(pd.hDC,100,134,640,480,0,0,SRCCOPY);
WhiteSky
what is m_image ?! what control ?!
Bravoone
-
what is m_image ?! what control ?!
Bravoone
It was an example and m_image was CImage for print images.
WhiteSky
-
It was an example and m_image was CImage for print images.
WhiteSky
you see my code? i need print preview for this HOW?help me!
Bravoone
-
It was an example and m_image was CImage for print images.
WhiteSky
I dont have any solution for my problem please help me !if you can !
Bravoone
-
i have a CDialog ,1 button for print i have a print but i need a button for print preview !How i have read all codeproject stuf but nothing ... this is my code for print : CPrintDialog dlgPrint(FALSE,PD_ALLPAGES,this); if (dlgPrint.DoModal()==IDOK) { // ** Attach the printer DC from the dialog // ** to a CDC object CDC dcPrint; dcPrint.Attach(dlgPrint.GetPrinterDC()); // ** Create and fill a DOCINFO structure DOCINFO myPrintJob; myPrintJob.cbSize = sizeof(myPrintJob); myPrintJob.lpszDocName = "MyPrintJob"; myPrintJob.lpszOutput = NULL; myPrintJob.lpszDatatype = NULL; myPrintJob.fwType = NULL; // ** Start the printing document if (dcPrint.StartDoc(&myPrintJob)>=0) { // ** Start a page dcPrint.StartPage(); CString sQuestion; m_question.GetWindowText(sQuestion); CString sText; sText = "Command"; CString sText1; sText1 = "Display :"; //////////////////////////////////////////////////////////////////////////////////////// dcPrint.TextOut(2000,350,sText); dcPrint.TextOut(300,500,sText1); // ** Throw the page dcPrint.EndPage(); // ** Close the document dcPrint.EndDoc(); } // ** Delete the printer device context dcPrint.DeleteDC(); }
Bravoone
i need some help over here please !
Bravoone
-
some times ago (I think two years ago) I had this problem I wanted to have a preview before print so I explain for you but before it(you can also use of printer driver if you dont have a real printer or dont access to it see this thread[^] ) I calculate dimension for pages like A4,A3,... and convert to screen and then use of a handle to display device context (hdc) sent my datas with BitBlt to screen and it worked and finaly sent my datas to printer like this PRINTDLG pd; ... m_Image.BitBlt(pd.hDC,100,134,640,480,0,0,SRCCOPY);
WhiteSky
You just blew him away by ten orders of magnitude. Explanations have to be on the fringe of insanely easy for him to bother grasping it. Anything beyond that, and you'll receive his standard, "How I do that?" rely.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I dont have any solution for my problem please help me !if you can !
Bravoone
I searched my CDs for send my program for you but I didnt find it instead I found this article that I think it will be helpful for you.:) see Introduction to MFC Printing[^]
WhiteSky
-
I dont have any solution for my problem please help me !if you can !
Bravoone
Does your problem solve with previous link?
WhiteSky