Howdy,
I'm trying to only show a tooltip when someone is hovering over the UltraGrid caption.
I've tried disabling the UItraToolTipManager in the hover, if it's not over the right UIElement but that's not working.
Here's my code:
private void ugAlerts_MouseHover(object sender, EventArgs e) { ultraToolTipManager1.Enabled = false; Point clientPt = ugAlerts.PointToClient(Cursor.Position); Object obj = ugAlerts.DisplayLayout.UIElement.ElementFromPoint(clientPt); if (obj.GetType() == typeof(Infragistics.Win.TextUIElement)) { Infragistics.Win.TextUIElement tuie = obj as Infragistics.Win.TextUIElement; if (tuie.Parent.GetType() == typeof(Infragistics.Win.UltraWinGrid.CaptionAreaUIElement)) { ultraToolTipManager1.Enabled = true; } } }
I really thinking I'm missing something simple....
Any guidance?
thanks!
Hi,
You can't really use MouseHover to control tooltips, because MouseHover deals with the entire control. So, for example, if you hover the mouse over any part of the grid and the MouseHover event fires, then you move the mouse over some other part of the grid, the MouseHover event will not fire again. It only fires again if the mouse leaves the control and comes back in.
If you want to change the tooltip on the grid based on the location of the mouse, then I recommend using the MouseMove event.
By the way... I could be wrong, but I think the event args for MouseHover are in client coords, so you don't need to use PointToClient. In any case, I am certain this is true for MouseMove.
Thanks Mike, I still can't get it to work...am I missing something?
private void ugAlerts_MouseMove(object sender, MouseEventArgs e) { Object obj = ugAlerts.DisplayLayout.UIElement.ElementFromPoint(e.Location); if (obj.GetType() != typeof(Infragistics.Win.TextUIElement)) { uttmTips.HideToolTip(); return; } Infragistics.Win.TextUIElement tuie = obj as Infragistics.Win.TextUIElement; if (tuie.Parent.GetType() != typeof(Infragistics.Win.UltraWinGrid.CaptionAreaUIElement)) { uttmTips.HideToolTip(); return; } Control o = sender as Control; UltraToolTipInfo toolTipInfo = new UltraToolTipInfo("Hello", ToolTipImage.Info, "Comment:", DefaultableBoolean.True); toolTipInfo.Appearance.BackColor = Color.White; toolTipInfo.Appearance.BackColor2 = Color.Cornsilk; toolTipInfo.Appearance.BackGradientStyle = GradientStyle.Elliptical; toolTipInfo.Appearance.ForeColor = Color.Black; uttmTips.AutoPopDelay = 0; uttmTips.SetUltraToolTip(o, toolTipInfo); uttmTips.ShowToolTip(o); }