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. print preview

print preview

Scheduled Pinned Locked Moved C / C++ / MFC
12 Posts 3 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.
  • B Bravoone_2006

    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

    H Offline
    H Offline
    Hamid Taebi
    wrote on last edited by
    #2

    Does print previewing without the Document/View Framework[^] helpful?


    WhiteSky


    B 1 Reply Last reply
    0
    • H Hamid Taebi

      Does print previewing without the Document/View Framework[^] helpful?


      WhiteSky


      B Offline
      B Offline
      Bravoone_2006
      wrote on last edited by
      #3

      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

      H 1 Reply Last reply
      0
      • B Bravoone_2006

        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

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #4

        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


        B D 2 Replies Last reply
        0
        • H Hamid Taebi

          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


          B Offline
          B Offline
          Bravoone_2006
          wrote on last edited by
          #5

          what is m_image ?! what control ?!

          Bravoone

          H 1 Reply Last reply
          0
          • B Bravoone_2006

            what is m_image ?! what control ?!

            Bravoone

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #6

            It was an example and m_image was CImage for print images.


            WhiteSky


            B 2 Replies Last reply
            0
            • H Hamid Taebi

              It was an example and m_image was CImage for print images.


              WhiteSky


              B Offline
              B Offline
              Bravoone_2006
              wrote on last edited by
              #7

              you see my code? i need print preview for this HOW?help me!

              Bravoone

              1 Reply Last reply
              0
              • H Hamid Taebi

                It was an example and m_image was CImage for print images.


                WhiteSky


                B Offline
                B Offline
                Bravoone_2006
                wrote on last edited by
                #8

                I dont have any solution for my problem please help me !if you can !

                Bravoone

                H 2 Replies Last reply
                0
                • B Bravoone_2006

                  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

                  B Offline
                  B Offline
                  Bravoone_2006
                  wrote on last edited by
                  #9

                  i need some help over here please !

                  Bravoone

                  1 Reply Last reply
                  0
                  • H Hamid Taebi

                    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


                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #10

                    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

                    1 Reply Last reply
                    0
                    • B Bravoone_2006

                      I dont have any solution for my problem please help me !if you can !

                      Bravoone

                      H Offline
                      H Offline
                      Hamid Taebi
                      wrote on last edited by
                      #11

                      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


                      1 Reply Last reply
                      0
                      • B Bravoone_2006

                        I dont have any solution for my problem please help me !if you can !

                        Bravoone

                        H Offline
                        H Offline
                        Hamid Taebi
                        wrote on last edited by
                        #12

                        Does your problem solve with previous link?


                        WhiteSky


                        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