Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   How can I use print handler to pring a file? (http://www.velocityreviews.com/forums/t700250-how-can-i-use-print-handler-to-pring-a-file.html)

Allen 10-03-2009 01:23 AM

How can I use print handler to pring a file?
 
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


Patrice 10-03-2009 09:58 AM

Re: How can I use print handler to pring a file?
 
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


Allen 10-03-2009 11:04 PM

Re: How can I use print handler to pring a file?
 
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:uPrYRABRKHA.1236@TK2MSFTNGP05.phx.gbl...
> 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



Patrice 10-04-2009 11:35 AM

Re: How can I use print handler to pring a file?
 
> 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



All times are GMT. The time now is 11:22 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.