G
Guest
I've noticed that if you click on a Windows.Forms.ToolStripButton then a
MouseLeave event will not occur until the button is released.
ToolStripMenuItems on the other hand will raise a MouseLeave event as soon as
the mouse moves outside of the item, even if the mouse button is held down.
You can observe this behavior using the following sample:
Public Class Form1
Inherits Windows.Forms.Form
Public Sub New()
Dim item1 As New Windows.Forms.ToolStripMenuItem("Item")
Dim item2 As New Windows.Forms.ToolStripButton("Button")
Dim ts As New Windows.Forms.ToolStrip
ts.Items.AddRange(New Windows.Forms.ToolStripItem() {item1, item2})
Me.Controls.Add(ts)
End Sub
End Class
I understand that this behavior is normally desirable and that in most cases
you would just use a ToolStripButton, but I have a situation where is would
be very helpful to have a ToolStripMenuItem behave like a ToolStripButton in
regards to the mouse. Is there any way to do this?
Thanks for any help!
Lance
MouseLeave event will not occur until the button is released.
ToolStripMenuItems on the other hand will raise a MouseLeave event as soon as
the mouse moves outside of the item, even if the mouse button is held down.
You can observe this behavior using the following sample:
Public Class Form1
Inherits Windows.Forms.Form
Public Sub New()
Dim item1 As New Windows.Forms.ToolStripMenuItem("Item")
Dim item2 As New Windows.Forms.ToolStripButton("Button")
Dim ts As New Windows.Forms.ToolStrip
ts.Items.AddRange(New Windows.Forms.ToolStripItem() {item1, item2})
Me.Controls.Add(ts)
End Sub
End Class
I understand that this behavior is normally desirable and that in most cases
you would just use a ToolStripButton, but I have a situation where is would
be very helpful to have a ToolStripMenuItem behave like a ToolStripButton in
regards to the mouse. Is there any way to do this?
Thanks for any help!
Lance