#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 ); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)