Regards,
How I can use to control UltraToolstips with UltraStateBar control?
How to apply to ToolTips each statusbar panel
Thanks in advance
Hi,
The inbox ToolTip class and the UltraToolTipManager apply a tooltip to a control.
If you want to apply a tooltip to part of a control, what you would typically do is change the tooltip on the control based on the current location of the mouse. The MouseMove event if usually a good place to do this.
You will also need to force the tooltip to re-display if the user moves from one panel to another without leaving the control. This can be done by keeping track of the last panel for which you displayed a tooltip. Here's some quick sample code.
private UltraStatusPanel lastMouseMovePanel; private void ultraStatusBar1_MouseMove(object sender, MouseEventArgs e) { UIElement element = this.ultraStatusBar1.UIElement.LastElementEntered; if (element == null) return; UltraStatusPanel panel = element.GetContext(typeof(UltraStatusPanel)) as UltraStatusPanel; if (panel == null || panel == this.lastMouseMovePanel) return; this.lastMouseMovePanel = panel; UltraToolTipInfo tooltipInfo = new UltraToolTipInfo("This is panel " + panel.Index, ToolTipImage.None, "Title", DefaultableBoolean.True); this.ultraToolTipManager1.SetUltraToolTip(this.ultraStatusBar1, tooltipInfo); this.ultraToolTipManager1.ShowToolTip(this.ultraStatusBar1); }
Hi Mike,
Thanks for youe answer....I "translate" the code from C# to VB...the result is something like this:
Private _lastMouseMovePanel As UltraStatusPanel
Private Sub StatusBar_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles StatusBar.MouseMove
Dim element As UIElement = Me.StatusBar.UIElement.LastElementEntered If Not IsNothing(element) Then Dim myPanel = element.GetContext(GetType(UltraStatusPanel)) If Not myPanel Is Nothing Then Me._lastMouseMovePanel = myPanel Dim tooltipInfo As UltraToolTipInfo = New UltraToolTipInfo("This is panel " + CStr(myPanel.Index), ToolTipImage.None, "Title", DefaultableBoolean.True) Me.MainToolTipManager.SetUltraToolTip(Me.StatusBar, tooltipInfo) Me.MainToolTipManager.ShowToolTip(Me.StatusBar) End If End If
End Sub
This code "works", I meant....do not show error and all the ojects and variables are filled but....the ToolTips is not displayed.....
There´s something wrong or missing with this code?
Thanks
PD: Sorry my english Mike