error in copy/ paste of image

Posted by sayyad on Stack Overflow See other posts from Stack Overflow or by sayyad
Published on 2011-01-08T15:04:06Z Indexed on 2011/01/08 15:53 UTC
Read the original article Hit count: 179

Filed under:

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,

© Stack Overflow or respective owner

Related posts about c#