Not that I'm aware of, or that is readily apparent from looking at the
ContextMenuStrip class members in MSDN.
http://msdn.microsoft.com/en-us/library/system.windows.forms.contextmenustrip_members(v=VS.100).aspx
That said, it's an interesting question, and I look forward to being
corrected
I cannot remember where I found this on the web (apologies to the
author) but these are the building blocks that I use to do this
particular job.
''' <summary>
''' ContextMenuStrip with a non-clickable "header" bar
''' </summary>
''' <remarks>
''' <para>
''' We needed this sub-class of
''' <see cref="T:System.Windows.Forms.ContextMenuStrip" /> because the
original automatically hides the menu when any item is clicked.
''' </para>
''' <para>
''' Given that our header item doesn't want this behaviour, we have to
not only extend the
''' <see cref="T:System.Window.Forms.ToolStripMenuitem" /> itself, but
also its containing
''' <see cref="T:System.Window.Forms.ContextMenuStrip" />.
''' </para>
''' </remarks>
Friend Class HeadedContextMenuStrip
Inherits ContextMenuStrip
Public Sub New( container as IContainer )
MyBase.New( container )
End Sub
Protected Overrides Sub OnItemClicked( e as
ToolStripItemClickedEventArgs )
{
If Not ( TypeOf e.ClickedItem Is ContextMenuHeader ) Then
MyBase.OnItemClicked( e )
End If
End Property
End Class
''' <summary>
''' Header item to be used in conjunction with the HeadedContextMenuStrip.
''' </summary>
Friend Class ContextMenuHeader
Inherits ToolStripMenuItem
Private Sub New()
MyBase.New()
End Sub
Public Sub New( text as String )
MyBase,New( text )
Me.BackColor = SystemColors.GradientInactiveCaption
Me.Font = New Font(Me.Font, FontStyle.Bold)
Me.ForeColor = SystemColors.MenuText
End Sub
Protected Overrides Function CreateDefaultDropDown() as
ToolStripDropDown
ToolStripDropDownMenu menu = New ToolStripDropDownMenu()
menu.OwnerItem = Me
return menu
End Function
Protected Overrides ReadOnly Property DismissWhenClicked() as Boolean
Get
Return False
End Get
End Property
End Class
HTH,
Phill W.