Type | Description | |||
ToolTip as Variant | A String expression that indicates the description of the tooltip, that supports built-in HTML format like described bellow. | |||
Title as Variant | If present, A String expression that indicates the title of the tooltip. | |||
Alignment as Variant | A long expression that indicates the alignment of the tooltip relative to the position of the cursor. If missing, the tooltip is aligned to the left/top corder. | |||
X as Variant | A single that specifies the current X location of the mouse pointer. The x values is always expressed in screen coordinates. If missing or -1, the current mouse X position is used. A string expression that indicates the offset to move the tooltip window relative to the cursor position. | |||
Y as Variant | A single that specifies the current Y location of the mouse pointer. The y values is always expressed in screen coordinates. If missing or -1, the current mouse Y position is used. A string expression that indicates the offset to move the tooltip window relative to the cursor position. |
The ToolTip parameter supports the following HTML elements:
or <font ;31><sha 404040;5;0><fgcolor=FFFFFF>outline anti-aliasing</fgcolor></sha></font> gets:
The Alignment parameter can be one of the followings:
Use numeric values as strings for X and Y parameters, to move the tooltip window relative to the position of the cursor. For instance, ShowToolTp("text",,,"11","12"), means that the tooltip window is moved 11 pixels on the X axis, and 12 pixels on the Y axis, before showing it in the default position. In this case the X and Y parameters MUST be passed as strings not as LONG values.
The following VB sample displays the tooltip when the cursor hovers the form:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) t.ShowToolTip "This is a bit of text that's shown when the cursor hovers the form" End Sub
The following VB.NET sample displays the tooltip when the cursor hovers the form:
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove t.ShowToolTip("This is a bit of text that's shown when the cursor hovers the form") End Sub
The following C# sample displays the tooltip when the cursor hovers the form:
private void Form1_MouseMove(object sender, MouseEventArgs e) { t.ShowToolTip("This is a bit of text that's shown when the cursor hovers the form", "", "", "", "" ); }
The following C++ sample displays the tooltip when the cursor hovers the form:
BOOL PreTranslateMessage(MSG* pMsg) { /* Handles the WM_MOUSEMOVE message during the PreTranslateMessage so it can show the tooltip even if we move the mouse over the inside controls too. As the WM_MOUSEMOVE message is not sent to dialog, if the cursor hovers the inside windows... */ if ( pMsg->message == WM_MOUSEMOVE ) { if ( m_spToolTip != NULL ) m_spToolTip->ShowToolTip( COleVariant( "This is a bit of text that's shown when the cursor hovers the form" ), vtMissing, vtMissing, vtMissing ); } return CDialog::PreTranslateMessage(pMsg); }
The following VFP sample displays the tooltip when the cursor hovers the form:
LPARAMETERS nButton, nShift, nXCoord, nYCoord with t .ShowToolTip("This is a bit of text that's shown when the cursor hovers the form") endwith