Question: I am currently using this code to screen capture the panel I created, but whenever I am saving it, the quality is bad. Is there any way to maintain the good quality when saving it?

I tried resizing the panel but the result is still the same.
I tried doing a normal screen shot with the snipping tool and it also has the same result with the codes I use.

Any suggestions? or help? 

```
private void SaveControlImage(Control theControl)
{
    snapCount++;

    int width = panel1.Size.Width;
    int height = panel1.Size.Height;

    Bitmap bm = new Bitmap(width, height, PixelFormat.Format64bppPArgb);

    panel1.DrawToBitmap(bm, new Rectangle(0, 0, width, height));
    //bm.Save(@"D:\TestDrawToBitmap.bmp", ImageFormat.Bmp);

    bm.Save(deskTopPath + @"/Offer_" + snapCount.ToString() + "_" + DateTime.Now.ToString("yyyyMMdd") + @".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}

```

---

Like here, it looks pixelated if you compare it to what you're reading now (like this website). I tried to screen cap the form but it looks like the uploaded picture so its useless

Screenshot:

![1](https://i.stack.imgur.com/HY9Z7.jpg)

Answer: 
This is what I use to save a screenshot:

```
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
private void SaveControlAsImage(Control control, string path)
{
    Bitmap bitmap = new Bitmap(control.Width, control.Height);
    control.DrawToBitmap(bitmap, control.Bounds);
    using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.ReadWrite))
    {
        /* using ImageFormat.Png or ImageFormat.Bmp saves the image with better quality */
        bitmap.Save(fs, ImageFormat.Png);
    }
}

```

[Control screenshot using Windows Snipping Tool](https://i.stack.imgur.com/B58J4.png)

[Control screenshot using SaveControlAsImage (ImageFormat.Png)](https://i.stack.imgur.com/XtZcQ.png)

[Control screenshot using SaveControlAsImage (ImageFormat.Jpeg)](https://i.stack.imgur.com/Wf9Vw.jpg)

It's not the best quality (just a little blurry), but this removes the distortion around the text and keeps the right color.

Sidenote: You're not using the parameter (`theControl`) passed to your method, so you might as well remove it (not recommended), or change all the calls to `panel1` inside the method to `theControl` and call the method like

```
this.SaveControlImage(this.panel1);

```

Also, when you're accessing just a property (i.e. `this.panel1.Size.Width`) it's better to just call the property instead of assign it to a variable. If you're calling a method and getting a value back (which you'll be using more than once), you must assign it to a variable (i.e. `int arrayCount = array.Count()`).
Windows Forms is not using vector graphics to draw the user interface. Therefore, all you can get generically is to draw the control to a Bitmap instead of to the screen. This works independently of whether your control is visible on the screen, but there is not more than that. If you want a higher-resolution image from a Windows Forms control, the only way is to resize the control and hope that it supports zooming.