How can I use print handler to pring a file?

Discussion in 'ASP .Net' started by Allen, Oct 3, 2009.

  1. Allen

    Allen Guest

    How can I use print handler to pring a file?

    --------------------------------------------------------------------------------

    Hi everybody,

    I need your help.

    The code below came from a book which teaches how to print a sketch. The
    book did not show how to print a file. Right now if I run this program (as
    is)it will show the printer dialog box. If I click OK (to print), the
    printer will print an empty paper. How can I use this code to print a file
    ("ReadMe.txt")?

    I would apprciate it if you could help.



    private: System::Void printToolStripMenuItem_Click(System::Object ^ sender,
    System::EventArgs ^ e)
    {
    // The PrintDocument holds the settings
    PrintDocument^ pdoc = gcnew PrintDocument();

    // Create a dialog and attach it to the document
    PrintDialog^ pd = gcnew PrintDialog();

    pd->Document = pdoc;

    // Show the dialog
    if (pd->ShowDialog() == System::Windows::Forms:ialogResult::OK)

    {
    // Add the page handler

    pdoc->PrintPage += gcnew PrintPageEventHandler(this,&Form1::printAPage);
    // Print the page
    pdoc->Print();

    }
    else
    MessageBox::Show("Print cancelled", "Information");
    }

    void PrintAPage(Object^ pSender, PrintPageEventArgs^ pe)
    {




    }


    --
    Thanks
    Allen
     
    Allen, Oct 3, 2009
    #1
    1. Advertising

  2. Allen

    Patrice Guest

    Patrice, Oct 3, 2009
    #2
    1. Advertising

  3. Allen

    Allen Guest

    Allen, Oct 4, 2009
    #3
  4. Allen

    Patrice Guest

    > Can you give me an address for a Windows programming group?

    I would try a group such as :

    microsoft.public.dotnet.framework.windowsforms.

    Also the link I provided earlier shows how to print a file assuming each
    line is small enought to fit on a single line. It uses C# but it should be
    easy to convert to C++/CLI.

    --
    Patrice
     
    Patrice, Oct 4, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. avashisht

    Pring array into a text file

    avashisht, Feb 16, 2004, in forum: Perl
    Replies:
    5
    Views:
    527
    Joe Smith
    Feb 21, 2004
  2. shruds
    Replies:
    1
    Views:
    870
    John C. Bollinger
    Jan 27, 2006
  3. keto
    Replies:
    0
    Views:
    998
  4. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    373
    David Cournapeau
    Dec 30, 2008
  5. Zeynel
    Replies:
    7
    Views:
    312
    Zeynel
    Nov 9, 2010
Loading...

Share This Page