academic wrote:
I'm trying the following but can't determine in the sub if e points to a
item that is checked. I did a quick watch and looked and looked but can not
find anything that I can use to determine if it is checked.
Am I missing something? Is it there?
Protected Overrides Sub OnRenderMenuIte mBackground(ByV al e As
ToolStripItemRe nderEventArgs)
If e.Item.Tag Is Nothing Then Exit Sub
MyBase.OnRender MenuItemBackgro und(e)
...
e.Item is declared as a ToolStripItem, which is a base class for *all*
the various bits and pieces that can appear on a ToolStrip. Not all of
these can be 'checked', so ToolStripItem doesn't have such a property.
BUT ToolStripMenuIt em (which I suspect is what you are interested in)
can be 'checked' and does have a Checked property. And
ToolStripMenuIt em *derives* from ToolStripItem, so the e.Item we are
passed might actually *be* a ToolStripMenuIt em. So we check (hoho):
Protected Overrides Sub OnRenderMenuIte mBackground(_
ByVal e As ToolStripItemRe nderEventArgs)
If e.Item.Tag Is Nothing Then Exit Sub
MyBase.OnRender MenuItemBackgro und(e)
' new stuff
If TypeOf e.Item Is ToolStripMenuIt em Then
Dim menuitem As ToolStripMenuIt em = DirectCast(e.It em,
ToolStripMenuIt em)
' now do stuff that depends on menuitem.Checke d
End If
--
Larry Lard
Replies to group please