Printing General

Create Your Print Document System::Drawing::Printing::PrintDocument ^printDoc; Start Printing //Setup the print dialog PrintDialog ^dlgPrint = gcnew PrintDialog(); dlgPrint->AllowSelection = true; dlgPrint->ShowNetwork = true; dlgPrint->Document = printDoc; dlgPrint->PrinterSettings->DefaultPageSettings->Landscape = true; //(This doesn’t necessarily work) dlgPrint->UseEXDialog = true; printDoc->BeginPrint += gcnew System::Drawing::Printing::PrintEventHandler(this, &DataGridViewPrint::PrintDoc_BeginPrint); printDoc->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler(this, &DataGridViewPrint::PrintDoc_PrintPage); if (dlgPrint->ShowDialog() != DialogResult::OK) { printDoc->BeginPrint -= gcnew System::Drawing::Printing::PrintEventHandler(this, […]

Read More

Page Settings

You can’t easily force things like margins and orientation, all you can do is use dlgPrint->PrinterSettings->DefaultPageSettings->Landscape = true; Which if not forced and often ignored leaving the user to have to decide. Detecting Page Orientation You can do this in the print page callback: void DataGridViewPrint::PrintDoc_PrintPage(System::Object ^sender, System::Drawing::Printing::PrintPageEventArgs ^e) { if (e->PageSettings->Landscape) //True for landscape

Read More