Results 1 to 3 of 3

Thread: Disable click on picturebox

  1. #1

    Thread Starter
    Frenzied Member aewarnick's Avatar
    Join Date
    Dec 2002
    Posts
    1,037

    Disable click on picturebox

    I have a picturebox that is clickable on my form. I would like to disable the click at a certain time but when I use

    pictureBox1.Enabled=false;

    to disable it the gif animation stops. How can I disable the click without stopping the animation?

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You have to unsubscribe from the delegate:
    this.pictureBox1.Click -= new System.EventHandler(this.pictureBox1_Click);

    To resubscribe to it:
    this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);

    Basically, go into the windows form generated code and find where visual studio put the subscribe call to the delegate, and use the same exact statement where you need it but just replace the + sign with a minus sign and it will unsubscribe the delegate.
    Last edited by hellswraith; Feb 1st, 2003 at 07:07 PM.

  3. #3

    Thread Starter
    Frenzied Member aewarnick's Avatar
    Join Date
    Dec 2002
    Posts
    1,037
    Thank you very much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width