Home All Groups Group Topic Archive Search About

toolstrip - mouse event for disabled items?

Author
6 Jun 2010 12:54 AM
Patrick F
I have been using VB9 express and have not been pleased with the behavior of
the tooltips for toolstrip items. the tooltip sometimes gets 'stuck' onto
the screen over other controls, painted over the top of them until a repaint
event of that control can clear it off.
rather than find a way to not have this happen, I chose to make my own
'tooltip' of sorts using a separate toolstrip and a label that appears at
the bottom of the form on the mouseover event for all my toolstripitems. it
works snazzy and looks good except for the toolstripitems that are disabled.
I can't seem to access any mouse events for them. I have searched my brains
out trying to find a way around this, and the 'GetItemAt' looked promising,
but doesn't seem to work :(

all I want is the to get the tooltiptext of any toolstripitem under the
mouse pointer, even if it is a disabled item.

here is the code I have, using the 'GetItemAt' method:

    Private Sub ts1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ts1.MouseMove
        Dim item As ToolStripItem = CType(ts1.GetItemAt(e.Location),
ToolStripItem)
        If item IsNot Nothing Then
            lblToolTip.Text = item.ToolTipText
        End If
    End Sub

can someone please help me.
thank-you,
Patrick

Author
6 Jun 2010 10:13 AM
Cor Ligthert[MVP]
Problem already solved by Patrick himself solution in the VB general forum

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/017160f3-024c-45d5-a716-3c90fda94d2b



Show quoteHide quote
"Patrick F" <gomental@nospam-hotmail.com> wrote in message
news:7073FD2B-5BC7-4B5E-82FE-0E96FEEAB582@microsoft.com...
> I have been using VB9 express and have not been pleased with the behavior
> of the tooltips for toolstrip items. the tooltip sometimes gets 'stuck'
> onto the screen over other controls, painted over the top of them until a
> repaint event of that control can clear it off.
> rather than find a way to not have this happen, I chose to make my own
> 'tooltip' of sorts using a separate toolstrip and a label that appears at
> the bottom of the form on the mouseover event for all my toolstripitems.
> it works snazzy and looks good except for the toolstripitems that are
> disabled. I can't seem to access any mouse events for them. I have
> searched my brains out trying to find a way around this, and the
> 'GetItemAt' looked promising, but doesn't seem to work :(
>
> all I want is the to get the tooltiptext of any toolstripitem under the
> mouse pointer, even if it is a disabled item.
>
> here is the code I have, using the 'GetItemAt' method:
>
>    Private Sub ts1_MouseMove(ByVal sender As Object, ByVal e As
> System.Windows.Forms.MouseEventArgs) Handles ts1.MouseMove
>        Dim item As ToolStripItem = CType(ts1.GetItemAt(e.Location),
> ToolStripItem)
>        If item IsNot Nothing Then
>            lblToolTip.Text = item.ToolTipText
>        End If
>    End Sub
>
> can someone please help me.
> thank-you,
> Patrick
>