Example
The following example creates text tips that display the row and column numbers corresponding to the pointer's location in a sheet. The text tips appear next to the pointer after the pointer remains stationary for 250 milliseconds. The text tips' background, foreground, and text appear as set in the example.
C++
void CmyWnd::MyFunc()
{
// Control displays text tips aligned to pointer with focus
fpSpread1.SetTextTip(4);
// Control displays text tips after 250 milliseconds
fpSpread1.SetTextTipDelay(250);
// Text tip displays custom font and colors
// Background is yellow, RGB(255, 255, 0)
// Foreground is dark blue, RGB(0, 0, 128)
fpSpread1.SetTextTipAppearance("Arial", 11, FALSE, FALSE, 0xFFFF, 0x800000);
}
void CmyWnd::OnTextTipFetch(long Col, long Row, long FAR* MultiLine, long FAR* TipWidth, BSTR FAR* TipText, BOOL FAR* ShowTip)
{
// Set tip to display and set tip's content
char buff1[20];
char buff2[20];
char buff3[50];
wchar_t buff4[50];
*ShowTip = TRUE;
SysFreeString(*TipText);
ltoa(Col,buff1,10);
ltoa(Row,buff2,10);
strcat(buff3,"Col ");
strcat(buff3," Row ");
strcat(buff3, buff2);
MultiByteToWideChar(CP_ACP,0,buff3,50,buff4,50);
*TipText = SysAllocString(buff4);
}
Visual Basic
Sub Form_Load()
Dim x As Boolean
' Control displays text tips aligned to pointer with focus
fpSpread1.TextTip = TextTipFloatingFocusOnly
' Control displays text tips after 250 milliseconds
fpSpread1.TextTipDelay = 250
' Text tip displays custom font and colors
' Background is yellow, RGB(255, 255, 0)
' Foreground is dark blue, RGB(0, 0, 128)
x = fpSpread1.SetTextTipAppearance("Arial", "11", False, False, &H0000FFFF&, &H00800000)
End Sub
Sub fpSpread1_TextTipFetch(ByVal Col As Long, ByVal Row As Long, MultiLine As Long, TipWidth As Long, TipText As String, ShowTip As Boolean)
' Set tip to display and set tip's content
ShowTip = True
TipText = "Col " & Col & ", Row " & Row
End Sub