There is a WinForm application (not WPF !!!), you need to print one of its controls. Used Bitmap, but the picture is poor quality, blurry. And the printed horror. The question, in fact, what did I do wrong and how to improve the quality of the picture?
private void toolStripMenuItem3_Click(object sender, EventArgs e) { PrintDialog pd = new PrintDialog(); PrintPreviewDialog ppd = new PrintPreviewDialog(); pd.Document = printDocument1; printDocument1.DocumentName = "График рабочего времени"; if (pd.ShowDialog() == DialogResult.OK) { ppd.Document = printDocument1; if (ppd.ShowDialog() == DialogResult.Abort) { printDocument1.PrinterSettings = pd.PrinterSettings; printDocument1.Print(); } } } private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) { Bitmap bmp = new Bitmap(tableLayoutPanel2.Width, tableLayoutPanel2.Height + 25); dataGridView1.ClearSelection(); tableLayoutPanel2.DrawToBitmap(bmp, tableLayoutPanel2.Bounds); e.Graphics.DrawImage(bmp, tableLayoutPanel2.Location); } Ps. Bitmap.SetResolution() and PrinterSettings.DefaultPageSettings.PrinterResolution tried not to help