private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Clipboard.GetDataObject().GetDataPresent("Bitmap"))
{
object o = Clipboard.GetDataObject().GetData("Bitmap");
if (o != null)
{
PBox.Image = (Image)o;
PBox.Width = PBox.Image.Width;
PBox.Height = PBox.Image.Height;
}
}
}
This works like a charm copy & pasting straight out of firefox. However, it doesn't copy over the alpha channel if the source is a .gif or .png or something. Is there anyway to get that data too? Right now it just converts these pixels to black (0, 0, 0, 255).
C# PictureBox Copy&Paste
I've implemented a little trick with the PictureBox control, where I added a context menu with "Paste" that when you click does this:
damn! Photoshop gets it too! it must be in the way Firefox copies it to the clipboard. Blast!
Forgive me if this is a dumb question, but what keeps you from just doing a right-click/save image from within Firefox?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement