![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How can I print 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 appreciate 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) { } If I put the following code inside the empty function (PrintAPage)I will be ablble to draw and print what I draw. But what I need is to print an already written text. Graphics* gr = pe->Graphics; Pen* pen1 = new Pen(Color::Black); // Draw the image Bitmap* bmp = new Bitmap(S"ramp1.gif"); gr->DrawImage(bmp, 10,10); for(int i=0; i<list->Count; i++) { Line* pl = dynamic_cast<Line*>(list->get_Item(i)); gr->DrawLine(pen1, pl->p1.X,pl->p1.Y, pl->p2.X,pl->p2.Y); } -- Thanks Allen |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Printing small file turns in to huge file in print queue | Vista General | |||
Error "Could Not Open The File: Access Denied" setting up print to file | General Discussion | |||
| Print to File/Output file name issue | Vista print fax & scan | |||
| Error in Printing using "Print To File" and RAW Print mode | Vista print fax & scan | |||
| View a Print-To-File File | Vista print fax & scan | |||