C# Programming
09-18-2009, 01:00 PM
Does anyone know how to copy a transparent image out of a C# application into the clipboard, and then paste it into Photoshop? When I try this the transparency (alpha) is lost. Here's as far as I got, but it doesn't work (transparency is still lost):
// Where bMap is the Bitmap to be copied...
IDataObject dataObject = new DataObject();
dataObject.SetData(bMap);
MemoryStream ms = new MemoryStream();
bMap.Save(ms, ImageFormat.Png);
dataObject.SetData("PNG", false, ms);
Clipboard.SetDataObject(dataObject, true);
// Where bMap is the Bitmap to be copied...
IDataObject dataObject = new DataObject();
dataObject.SetData(bMap);
MemoryStream ms = new MemoryStream();
bMap.Save(ms, ImageFormat.Png);
dataObject.SetData("PNG", false, ms);
Clipboard.SetDataObject(dataObject, true);