Jump to content

gregdosborne

Newbies
  • Posts

    3
  • Joined

  • Last visited

Everything posted by gregdosborne

  1. Thanks Rick, but I was looking for a way to paste an entire image into my application from Paint.NET.
  2. My primary graphics tool is Paint.Net, but I have found an inadequacy for what I am doing. Paint.NET copies data to the clipboard in the following formats PaintDotNet.MaskedSurface Format17 System.Drawing.Bitmap Bitmap DeviceIndependentBitmap found by examining data.GetFormats() in C#. I cannot use PaintDotNet.MaskedSurface in my application and the others don't provide full transparency information for PNGs. Is there a way to have Paint.NET copy data to the clipboard using "PNG" format? In my app, I can copy an image into the clipboard using the following code, and all transparency information is retained. using (MemoryStream stream = new MemoryStream()) { _Bitmap.Save(stream, ImageFormat.Png); var data = new DataObject("PNG", stream); Clipboard.Clear(); Clipboard.SetDataObject(data, true); } and I can read the same from the clipboard using the following IDataObject data = Clipboard.GetDataObject(); if (data.GetFormats().Contains("PNG")){ MemoryStream ms = (System.IO.MemoryStream)data.GetData("PNG"); _Bitmap = (Bitmap)Bitmap.FromStream(ms, true); } Can this be accomplished in Paint.NET, or can an extension be created that will do this? Thanks in advance...
  3. To properly paste a PNG image to the clipboard, do the following using (MemoryStream stream = new MemoryStream()) { _Bitmap.Save(stream, ImageFormat.Png); var data = new DataObject("PNG", stream); Clipboard.Clear(); Clipboard.SetDataObject(data, true); } This should take care of your problems.
×
×
  • Create New...