Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example displays a different picture for each button state for a two-state button.

To access the file used in this sample, change the path in the code to the path for your product installation's \SAMPLES\FILES directory.

C++

void CmyWnd::MyFunc()
{
    CPictureHolder pic;
        // Specify a cell
        m_Spread1.SetCol(2);
        m_Spread1.SetRow(3);
        // Define cell type as button
        m_Spread1.SetCellType(7);
        // Make button a two-state button
        m_Spread1.SetTypeButtonType(1);
        // Increase shadow size to accentuate the two-state
        // button
        m_Spread1.SetTypeButtonShadowSize(3);
        // Provide picture for when button is up
        // Convert hBitmap
        pic.CreateFromBitmap(IDB_HAPPY);
        m_Spread1.SetTypeButtonPicture(pic.GetPictureDispatch());
        // Provide picture for when button is down
        // Convert hBitmap
        pic.CreateFromBitmap(IDB_SAD);
        m_Spread1.SetTypeButtonPictureDown(pic.GetPictureDispatch());
        // Change height of row to display the picture
        m_Spread1.SetRowHeight(3,20);
}

Visual Basic

' Specify a cell
fpSpread1.Col = 2
fpSpread1.Row = 3
' Define cell type as button
fpSpread1.CellType = CellTypeButton
' Make button a two-state button
fpSpread1.TypeButtonType = TypeButtonTypeTwoState
' Increase shadow size to accentuate the two-state button
fpSpread1.TypeButtonShadowSize = 3
' Provide picture for when button is up
fpSpread1.TypeButtonPicture = LoadPicture("C:\Samples\Files\HAPPY.BMP")
' Provide picture for when button is down
fpSpread1.TypeButtonPictureDown = LoadPicture("C:\Samples\Files\SAD.BMP")
' Change height of row to display the picture
fpSpread1.RowHeight(3) = 20

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.