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?
Printable View
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?
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.
Thank you very much.