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. Managed C++/CLI
  4. C++ Windows Form Application Printing

C++ Windows Form Application Printing

Scheduled Pinned Locked Moved Managed C++/CLI
graphicshelpc++collaborationquestion
10 Posts 1 Posters 6 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    this is my code in windows form.... it compiles without error but it prints blank page.... where i done wrong?? please help...

    #pragma endregion
    // Declare the PrintDocument object.

    private: System::Void Button1\_Click\_1(System::Object^  sender, System::EventArgs^  e) {
    

    PrintDialog1->AllowSomePages = true;

    PrintDialog1->ShowHelp = true;

    PrintDocument ^docToPrint = gcnew PrintDocument;
    PrintDialog1->Document = docToPrint;
    if ( docToPrint == nullptr )
    System::Windows::Forms::MessageBox::Show( "null" );

    if ( PrintDialog1 == nullptr )
    System::Windows::Forms::MessageBox::Show( "pnull" );

    System::Windows::Forms::DialogResult result = PrintDialog1->ShowDialog();
    System::Windows::Forms::MessageBox::Show( result.ToString() );

    if ( result == System::Windows::Forms::DialogResult::OK )
    {
    docToPrint->Print();
    }

             }
    

    private: System::Void document_PrintPage_1(System::Object^ sender, System::Drawing::Printing::PrintPageEventArgs^ e) {
    String^ text = "In document_PrintPage method.";
    System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Times New Roman",20,System::Drawing::FontStyle::Bold );

    e->Graphics->DrawString("EAK TEAM TEST!!!",printFont,Brushes::Black,50,50);
    e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black, 10, 10 );
    }

    L 2 Replies Last reply
    0
    • L Lost User

      this is my code in windows form.... it compiles without error but it prints blank page.... where i done wrong?? please help...

      #pragma endregion
      // Declare the PrintDocument object.

      private: System::Void Button1\_Click\_1(System::Object^  sender, System::EventArgs^  e) {
      

      PrintDialog1->AllowSomePages = true;

      PrintDialog1->ShowHelp = true;

      PrintDocument ^docToPrint = gcnew PrintDocument;
      PrintDialog1->Document = docToPrint;
      if ( docToPrint == nullptr )
      System::Windows::Forms::MessageBox::Show( "null" );

      if ( PrintDialog1 == nullptr )
      System::Windows::Forms::MessageBox::Show( "pnull" );

      System::Windows::Forms::DialogResult result = PrintDialog1->ShowDialog();
      System::Windows::Forms::MessageBox::Show( result.ToString() );

      if ( result == System::Windows::Forms::DialogResult::OK )
      {
      docToPrint->Print();
      }

               }
      

      private: System::Void document_PrintPage_1(System::Object^ sender, System::Drawing::Printing::PrintPageEventArgs^ e) {
      String^ text = "In document_PrintPage method.";
      System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Times New Roman",20,System::Drawing::FontStyle::Bold );

      e->Graphics->DrawString("EAK TEAM TEST!!!",printFont,Brushes::Black,50,50);
      e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black, 10, 10 );
      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You have already asked this in QA. Please do not cross post.

      L 1 Reply Last reply
      0
      • L Lost User

        this is my code in windows form.... it compiles without error but it prints blank page.... where i done wrong?? please help...

        #pragma endregion
        // Declare the PrintDocument object.

        private: System::Void Button1\_Click\_1(System::Object^  sender, System::EventArgs^  e) {
        

        PrintDialog1->AllowSomePages = true;

        PrintDialog1->ShowHelp = true;

        PrintDocument ^docToPrint = gcnew PrintDocument;
        PrintDialog1->Document = docToPrint;
        if ( docToPrint == nullptr )
        System::Windows::Forms::MessageBox::Show( "null" );

        if ( PrintDialog1 == nullptr )
        System::Windows::Forms::MessageBox::Show( "pnull" );

        System::Windows::Forms::DialogResult result = PrintDialog1->ShowDialog();
        System::Windows::Forms::MessageBox::Show( result.ToString() );

        if ( result == System::Windows::Forms::DialogResult::OK )
        {
        docToPrint->Print();
        }

                 }
        

        private: System::Void document_PrintPage_1(System::Object^ sender, System::Drawing::Printing::PrintPageEventArgs^ e) {
        String^ text = "In document_PrintPage method.";
        System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Times New Roman",20,System::Drawing::FontStyle::Bold );

        e->Graphics->DrawString("EAK TEAM TEST!!!",printFont,Brushes::Black,50,50);
        e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black, 10, 10 );
        }

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        See http://www.codeproject.com/KB/printing/[^] for samples and articles on printing in .NET.

        Use the best guess

        L 1 Reply Last reply
        0
        • L Lost User

          You have already asked this in QA. Please do not cross post.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          yes .. but i didnt get an answer... and this is very very important to me...

          "The more quieter you become, the more you are able to hear..."

          L 1 Reply Last reply
          0
          • L Lost User

            See http://www.codeproject.com/KB/printing/[^] for samples and articles on printing in .NET.

            Use the best guess

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            i dont see any tutorial for c++ windows form???? please help

            "The more quieter you become, the more you are able to hear..."

            L 1 Reply Last reply
            0
            • L Lost User

              i dont see any tutorial for c++ windows form???? please help

              "The more quieter you become, the more you are able to hear..."

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              You will have to look at the C# and VB.NET samples and adapt your code from them, as they all use the same .NET framework.

              Use the best guess

              L 1 Reply Last reply
              0
              • L Lost User

                yes .. but i didnt get an answer... and this is very very important to me...

                "The more quieter you become, the more you are able to hear..."

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                eakteam wrote:

                very very important to me

                So? That is no reason to rudely post this over and over.

                L 1 Reply Last reply
                0
                • L Lost User

                  eakteam wrote:

                  very very important to me

                  So? That is no reason to rudely post this over and over.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  ok i see ur disturbing... im sorry. nobody born with c++ LANGUAGE knowledge.. u too, like me was amateur....

                  "The more quieter you become, the more you are able to hear..."

                  L 1 Reply Last reply
                  0
                  • L Lost User

                    You will have to look at the C# and VB.NET samples and adapt your code from them, as they all use the same .NET framework.

                    Use the best guess

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    ok i will see harder... thank you

                    "The more quieter you become, the more you are able to hear..."

                    1 Reply Last reply
                    0
                    • L Lost User

                      ok i see ur disturbing... im sorry. nobody born with c++ LANGUAGE knowledge.. u too, like me was amateur....

                      "The more quieter you become, the more you are able to hear..."

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      Okaaaaaaaaaaaay what exactly does that have to do with anything? Knowing C++ is not a prerequisite to following the forum posting guidelines or for having some manners.

                      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