Domanda

I would like to create a picture of the ILPanel and copy it to the clipboard or save to disk. Unfortunately, I always get a white image.

Code:

Bitmap bitmap = new Bitmap(ilpnlChart.Bounds.Width, ilpnlChart.Bounds.Height);
ilpnlChart.DrawToBitmap(bitmap, ilpnlChart.Bounds);

Clipboard.SetImage(bitmap);

// TEST
bitmap.Save(@"C:\Temp\chart.jpg");
È stato utile?

Soluzione

You can use an GDI or SVG renderer in order to export your scene to a static image.

Take a look at http://ilnumerics.net/offscreen-rendering.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top