Bober02 Posted August 9, 2010 Report Share Posted August 9, 2010 Hey All, I am using theis piece of code to export chart to clipboard, but it is throwing exception when I try to paste it later into paint for instance... // create a memory stream to save the chart image var stream = new MemoryStream(); // save the chart image to the stream chart1.Export(FileFormat.Bitmap, stream); // create a bitmap using the stream var bmp = new Bitmap(stream); // save the bitmap to the clipboard Clipboard.SetDataObject(bmp); I get COMexception: Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC)). Any ideas? Quote Link to comment Share on other sites More sharing options...
JuanC Posted August 11, 2010 Report Share Posted August 11, 2010 I copied your code and it worked fine on 2 different machines. You might want to try changing your SetDataObject to this to see if it makes any difference Clipboard.SetDataObject(new DataObject(DataFormats.Bitmap, bmp), true); Also you can try exporting as a png instead of bitmap, both changes also worked in our tests. JuanC Quote Link to comment Share on other sites More sharing options...
Bober02 Posted August 11, 2010 Author Report Share Posted August 11, 2010 Managed to fix this issue. Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.