Clipboard.ContainsImage():
- First of all it returns a Boolean type that means either "true" or "false".
- Indicates whether there is data on the clipboard that is in the System.Windows.Forms.DataFormats.Bitmap format or that can be converted to that format.
Clipboard.GetImage():
- It returns the image itself.
- Retrieves the image from the clipboard.
PictureBoxSizeMode:
- It is used to specify how an image is positioned within a System.Windows.Forms.PictureBox.
- There are a total of five possible types of "SizeMode" for the "Picturebox" Control.
o Normal
o StretchImage
o AutoSize
o CenterImage
o Zoom
- For more understanding of the "SizeModes" see the images below:
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBox1.SizeMode = PictureBoxSizeMode.CenterImage;
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
Code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DisplayClipboardImage
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (Clipboard.ContainsImage())
{
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = Clipboard.GetImage();
}
else
{
MessageBox.Show("Clipboard is empty. Please Copy Image.");
}
}
}
}

Heather CzerniakPosted Aug 31, 2017, 3:31 PM
I've tried pasting an image from a location on my hard disk to a picturebox and my app crashes with a null reference exception, supposedly because copying an image from a hard disk actually copies the image's filepath. I've also noticed that in the case of pasting animated GIFs into a picturebox, only one frame is pasted. I'm guessing it's because the clipboard treats every image as a Bitmap. Any workarounds to get an animated GIF to copy, paste and animate once it's pasted?
Prabhakar PariharPosted Apr 22, 2011, 3:45 AM
Nice Article .