error in copy/ paste of image
- by sayyad
I am getting an error by implementing this simple code. I donot understand where I am doing mistake.
// ERROR
An unhandled exception of type 'System.NullReferenceException' occurred in ImageCSharp.exe
Additional information: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
I can get clipboard text but why i can't get /set image.
//CODE
public void copy()
{
// Determine the active child form.
fImage activeChild = this.ActiveMdiChild as fImage;
if (activeChild != null)
{
PictureBox mypicbox = activeChild.picbox;
string win_name = activeChild.Tag.ToString();
Clipboard.SetImage(mypicbox.Image);
Clipboard.SetText(win_name);
}
}
private void paste()
{
Image im= Clipboard.GetImage();
this.pictureBox1.Image = im;
MessageBox.Show(im.Size.ToString());
}
regards,