delegate void CopyClipboardCallbackDelegate(Bitmap image);
public void CopyClipboardCallback(Bitmap image)
{
if (this.InvokeRequired)
{
CopyClipboardCallbackDelegate d = new CopyClipboardCallbackDelegate(CopyClipboardCallback);
this.Invoke(d, image);
}
else
{
using (MemoryStream stream = new MemoryStream())
{
image.Save(stream, ImageFormat.Png);
var data = new DataObject("PNG", stream);
Clipboard.Clear();
Clipboard.SetDataObject(data, true);
}
}
}
No comments:
Post a Comment