Don't make your life harder than it can be, don't use "-=". Instead, add a check of some Boolean flag you can introduce as a member of the declaring class (a
Form
class, a
Window
class, whatever); let's say, you name
AllowDiceBoxClick
.
Add the check in the very beginning of you
Click
handler:
if (!AllowDiceBoxClick) return;
and you are done!
Just in case:
Review your design to see if you really need
PictireBox
. Most likely, in your case this is fine, but if you need a bit more complex processing, take into account my past answer:
How do I clear a panel from old drawing[
^].
—SA