Bill,
What I did is to create a ToolBarEx class that has a ToolBarButtonEx class.
The ToolBarButtonEx class has a Click event, while the TooBarEx class
overrides the onButtonClick method (handles the ButtonClick event) so that
is can have the respective ToolBarButtonEx class raise its event...
Something like:
Public Class ToolBarEx
Inherits ToolBar
Protected Overrides Sub OnButtonClick(ByVal e As
ToolBarButtonClickEventArgs)
If TypeOf e.Button Is ToolBarButtonEx Then
DirectCast(e.Button, ToolBarButtonEx).PerformClick()
End If
MyBase.OnButtonClick(e)
End Sub
<Editor(GetType(Design.ToolBarButtonExCollectionEditor),
GetType(System.Drawing.Design.UITypeEditor))> _
Public Shadows ReadOnly Property Buttons() As
ToolBar.ToolBarButtonCollection
Get
Return MyBase.Buttons()
End Get
End Property
End Class
Public Class ToolBarButtonEx
Inherits ToolBarButton
Public Event Click As EventHandler
Friend Sub PerformClick()
OnClick(EventArgs.Empty)
End Sub
Protected Overridable Sub OnClick(ByVal e As EventArgs)
RaiseEvent Click(Me, e)
End Sub
End Class
Namespace Design
Public Class ToolBarButtonExCollectionEditor
Inherits CollectionEditor
Public Sub New(ByVal type As System.Type)
MyBase.New(type)
End Sub
Protected Overrides Function CreateNewItemTypes() As
System.Type()
Return New Type() {GetType(ToolBarButtonEx)}
End Function
End Class
End Namespace
Hope this helps
Jay