PC Review


Reply
Thread Tools Rate Thread

How can I use print handler to pring a file?

 
 
Allen
Guest
Posts: n/a
 
      3rd Oct 2009
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

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      3rd Oct 2009
Wrong group ? Try
http://msdn.microsoft.com/en-us/libr...ent.print.aspx.

A Windows programming group would be better suited (this one is for web
applications).

--
Patrice

 
Reply With Quote
 
Allen
Guest
Posts: n/a
 
      4th Oct 2009
Hi Patrice,
Can you give me an address for a Windows programming group?

--
Thanks
Allen
"Patrice" <http://scribe-en.blogspot.com/> wrote in message
news:(E-Mail Removed)...
> Wrong group ? Try
> http://msdn.microsoft.com/en-us/libr...ent.print.aspx.
>
> A Windows programming group would be better suited (this one is for web
> applications).
>
> --
> Patrice


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      4th Oct 2009
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for using print handler Allen Microsoft Dot NET Framework Forms 2 6th Oct 2009 09:03 PM
SP2 IE can't pring Franz Chernjak Windows XP Beta 1 11th Jul 2004 07:51 AM
$PRING MADNE$$ \G\ Windows XP Customization 0 27th Apr 2004 05:42 AM
Pring Web page? Shane Microsoft VB .NET 3 7th Jan 2004 11:16 AM
Pring file path in excel Igor Microsoft Excel Misc 3 17th Jul 2003 03:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:47 PM.