Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a sheet that has a note in the B1 cell. The background color of the cell note is yellow. The cell note indicator is displayed and the TextTipFetch event occurs when the pointer is over the indicator.

C++

void CMFCDemoDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);

HDC hdcScreen;
    LOGFONT logFont;
    TSpread* m_Spread = (TSpread*)GetDlgItem(IDC_SPREAD);

    hdcScreen = ::GetDC(NULL);
    memset(&logFont, 0, sizeof(LOGFONT));
    _tcscpy(logFont.lfFaceName, "Arial");

    logFont.lfHeight = - MulDiv((int)(9 * 20), GetDeviceCaps(hdcScreen, LOGPIXELSY), 72 * 20);
    logFont.lfWeight = FW_BOLD;
    logFont.lfItalic = FALSE;
    logFont.lfStrikeOut = FALSE;
    logFont.lfUnderline = FALSE;

    m_Spread.TextTip(TextTipFloating, 2, &logFont, RGB(255,255,0), RGB(0,0,0));
    m_Spread.CellNoteIndicator(CellNoteIndicatorShowAndFireEvent);
    m_Spread.CellNote(2, 1, "Russell Jacobs wrote ''Visual Basic 4 by Example : The Easiest Way to Learn How to Program.''");

    ::ReleaseDC(NULL, hdcScreen);
}

LRESULT CMFCDemoDlg::OnTextTipFetch(WPARAM, LPARAM lParam)
{
LPSS_TEXTTIPFETCH lpTextTipFetch = (LPSS_TEXTTIPFETCH)lParam;
    TSpread* m_Spread = (TSpread*)GetDlgItem(IDC_SPREAD)

    if( m_Spread->IsFetchCellNote() )
        lpTextTipFetch->fShow = TRUE;
    else
        lpTextTipFetch->fShow = FALSE;

    return(0);
}

Visual Basic

Sub Form_Load()
    fpSpread1.TextTip = TextTipFloating
    fpSpread1.Col = 2
    fpSpread1.Row = 1
    fpSpread1.CellNoteIndicator = CellNoteIndicatorShowAndFireEvent
    fpSpread1.CellNote = "Russell Jacobs wrote ''Visual Basic 4 by Example : The Easiest Way to Learn How to Program.''"
End Sub

Sub fpSpread1_TextTipFetch(ByVal Col As Long, ByVal Row As Long, MultiLine As Integer, TipWidth As Long, TipText As String, ShowTip As Boolean)
    If fpSpread1.IsFetchCellNote Then
        fpSpread1.SetTextTipAppearance "Arial", 9, True, False, &HFFFF&, &H0
    End If
End Sub

Copyright © GrapeCity, inc. All rights reserved.