Saving Panel as an Image

I think the problem may be that you're using the "Clone" method.

Try "DrawToBitmap" - that's worked for me in the past.

Here's a sample that saves a bitmap from a control called "plotPrinter":

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

        Bitmap bm = new Bitmap(width, height);
        plotPrinter.DrawToBitmap(bm, new Rectangle(0, 0, width, height));

        bm.Save(@"D:\TestDrawToBitmap.bmp", ImageFormat.Bmp);
        Be aware of saving directly to the C directly as this is not 
        permitted with newer versions of window, try using SaveFileDialog.
    SaveFileDialog sf = new SaveFileDialog();
    sf.Filter = "Bitmap Image (.bmp)|*.bmp|Gif Image (.gif)|*.gif|JPEG Image (.jpeg)|*.jpeg|Png Image (.png)|*.png|Tiff Image (.tiff)|*.tiff|Wmf Image (.wmf)|*.wmf";
    sf.ShowDialog();
    var path = sf.FileName; 

Tags:

C#

Drawing