Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
995
Detect mouse enter cell "Text" and change appearance?
posted

I want to do something like hot tracking on a cell but only when the mouse is over the text in the cell. I have an email address there and when someone mouse's over I want to change the color (just like with a URL style). Also when the text is clicked I will do the email function.

 I know how to use the MouseEnterElement and I think there is an element for just text but I can't remember what it is. Maybe there is a better way. Can someone show me how to detect when the mouse is over the text of the cell and not just the cell itself?

 Thanks!

  • 995
    Verified Answer
    posted

    I figured it out. Set the style to FormattedLinkLabel and then check the mouseenterelement event for something like this:

    cell = e.Element.GetContext(GetType(UltraGridCell))

    If Not cell Is Nothing Then

    'WE ARE IN A CELL NOW CHECK AND SEE IF WE ARE OVER THE TEXT OF THE CELL

    '

    If e.Element.GetType.ToString.ToLower.EndsWith(".textsectionuielement") Then

    IsOverCellText = True

    cell.Appearance.ForeColor = Color.Red

    cell.Appearance.Cursor = Cursors.Hand

    Else

    IsOverCellText = False

    End If

    Else

    IsOverCellText = False

    End If

    And then on the mouseleaveelement event check for the samething but replace the color.