c# - ToolStripButton "Reset Appearance" / "Fire Leave Event" -


i have toolstripbutton performs action. user clicks button , button disabled prevent action being performed twice. after action complete button re-enabled. works perfectly...except:

because button disabled not fire "mouseleave" event , result appearance of button not updated. absolutely clear, when mouse enters toolstripbutton button highlighted in orange (by default) black box around it. highlight not being removed when re-enable button. mouse cursor is, time, long gone control. mousing on button naturally fixes button redrawing it.

what method on toolstripbutton "resets" appearance. such method may exist on toolstrip, despite searching have been unable find this.

as alternative fire "mouse leave" event on button directly. far know there no way in c# .net.

any advice @ point in time appreciated, naturally don't want tear application , replace tool strip.

update: reproduced problem, trying figuring out!

i didn't better way other reset style in click event

    private void toolstripbutton1_click(object sender, eventargs e)     {         toolstripbutton1.backcolor = color.fromknowncolor(knowncolor.control);         toolstripbutton1.enabled = false;     }      private void toolstripbutton1_mouseenter(object sender, eventargs e)     {         toolstripbutton1.backcolor = color.red;     }      private void toolstripbutton1_mouseleave(object sender, eventargs e)     {         toolstripbutton1.backcolor = color.fromknowncolor(knowncolor.control);     } 

hope helps!


have tried control.invalidate()?

from msdn: invalidates entire surface of control , causes control redrawn.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -