MyPrintDialog.AllowCurrentPage = false;
MyPrintDialog.AllowPrintToFile = false;
MyPrintDialog.AllowSelection = false;
MyPrintDialog.AllowSomePages = false;
MyPrintDialog.ShowHelp = false;
MyPrintDialog.ShowNetwork = false;
if (MyPrintDialog.ShowDialog() != DialogResult.OK)
return false;
printDocument1.DocumentName = "Client Reprots";
printDocument1.PrinterSettings = MyPrintDialog.PrinterSettings;
printDocument1.DefaultPageSettings = MyPrintDialog.PrinterSettings.DefaultPageSettings;
printDocument1.DefaultPageSettings.Margins = new Margins(40, 40, 40, 40);
if (MessageBox.Show("Do you want the report to be centered on the page", "InvoiceManager - Center on Page", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
MyDataGridViewPrinter = new DataGridViewPrinter(dataGridView1, printDocument1, true, true, "Client", new Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true);
}
else
{
MyDataGridViewPrinter = new DataGridViewPrinter(dataGridView1, printDocument1, false, true, "Client", new Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true);
}
return true;