title: How to print clearly contents of panel (basically labels) to printer in C# WinForms
body: <p>I have this code for printing a panel to a printer. It has labels and those labels are the only thing that I want to print. It works but when it prints, the labels doesn't print clearly. Its like blurred or something.</p>
  
  <pre><code>private void btnPrint_Click(object sender, EventArgs e)
  { 
       Print(panel1);
  }
  
  public void Print(Panel pnl)
  {
          pannel = pnl;
          GetPrintArea(pnl);
  
          if (cmbPrinter.SelectedIndex != -1)
          {
              printdoc1.PrinterSettings.PrinterName = cmbPrinter.SelectedItem.ToString();
          }
  
          if (batchForm.printInBatch)
              printdoc1.Print();
          else
          {
              previewdlg.Document = printdoc1;
              previewdlg.ShowDialog();
          }
  }
  
  public void GetPrintArea(Panel pnl)
  {
          MemoryImage = new Bitmap(pnl.Width, pnl.Height);
          Rectangle rect = new Rectangle(0, 0, pnl.Width, pnl.Height);
          pnl.DrawToBitmap(MemoryImage, new Rectangle(0, 0, pnl.Width, pnl.Height));
  }
  
  protected override void OnPaint(PaintEventArgs e)
  {
          if (MemoryImage != null)
          {
              e.Graphics.DrawImage(MemoryImage, 0, 0);
              base.OnPaint(e);
          }
  }
  
  public void printdoc1_PrintPage(object sender, PrintPageEventArgs e)
  {
          Rectangle pagearea = e.PageBounds;
          e.Graphics.DrawImage(MemoryImage, 0, 0);
  }
  </code></pre>