Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example provides different pictures for each state of a three-state check box cell.

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++

// Define variables
PIC picture;
HBITMAP hBitmap;   
// Specify a cell
m_Spread.SetCol(2);
m_Spread.SetRow(3);
// Define cell type as check box
m_Spread.SetCellType(CellTypeCheckBox);
// Center the check box within the cell
m_Spread.SetTypeCheckCenter(TRUE);
// Make it a three state check box
m_Spread.SetTypeCheckType(TypeCheckTypeThreeState);
// Define the pictures used for each state of the check box
// Picture for False state
// Convert hBitmap
CPictureHolder picture;
HBITMAP hBitmap = AfxGetApp()->LoadBitmap(IDB_BITMAP1);
picture.CreateFromBitmap(hBitmap);
m_Spread.SetTypeCheckPicture(0, picture.GetPictureDispatch());
CPictureHolder picture;
HBITMAP hBitmap = AfxGetApp()->LoadBitmap(IDB_BITMAP2);
picture.CreateFromBitmap(hBitmap);
m_Spread.SetTypeCheckPicture(1, picture.GetPictureDispatch());
CPictureHolder picture;
HBITMAP hBitmap = AfxGetApp()->LoadBitmap(IDB_BITMAP3);
picture.CreateFromBitmap(hBitmap);
m_Spread.SetTypeCheckPicture(2, picture.GetPictureDispatch());
CPictureHolder picture;
HBITMAP hBitmap = AfxGetApp()->LoadBitmap(IDB_BITMAP4);
picture.CreateFromBitmap(hBitmap);
m_Spread.SetTypeCheckPicture(3, picture.GetPictureDispatch());
CPictureHolder picture;
HBITMAP hBitmap = AfxGetApp()->LoadBitmap(IDB_BITMAP5);
picture.CreateFromBitmap(hBitmap);
m_Spread.SetTypeCheckPicture(4, picture.GetPictureDispatch());
CPictureHolder picture;
HBITMAP hBitmap = AfxGetApp()->LoadBitmap(IDB_BITMAP6);
picture.CreateFromBitmap(hBitmap);
m_Spread.SetTypeCheckPicture(5, picture.GetPictureDispatch());
// Set the column width
m_Spread.SetColWidth(2,10);
// Set the row height
m_Spread.SetRowHeight(3,20);

Visual Basic

' Specify a cell
fpSpread1.Col = 2
fpSpread1.Row = 3
' Define cell type as check box
fpSpread1.CellType = CellTypeCheckBox
' Center the check box within the cell
fpSpread1.TypeCheckCenter = True
' Make it a three state check box
fpSpread1.TypeCheckType = TypeCheckTypeThreeState
' Define the pictures used for each state of the check box
' Picture for False state
fpSpread1.TypeCheckPicture(0) = LoadPicture("C:\Samples\Files\Pict0.jpg")
' Picture for True state
fpSpread1.TypeCheckPicture(1) = LoadPicture("C:\Samples\Files\Pict1.jpg")
' Picture for False state, button pressed
fpSpread1.TypeCheckPicture(2) = LoadPicture("C:\Samples\Files\Pict2.jpg")
' Picture for True state, button pressed
fpSpread1.TypeCheckPicture(3) = LoadPicture("C:\Samples\Files\Pict3.jpg")
' Picture for Grayed state
fpSpread1.TypeCheckPicture(4) = LoadPicture("C:\Samples\Files\Pict4.jpg")
' Picture for Grayed state, button pressed
fpSpread1.TypeCheckPicture(5) = LoadPicture("C:\Samples\Files\Pict5.jpg")
' Set the column width
fpSpread1.ColWidth(2) = 10
' Set the row height
fpSpread1.RowHeight(3) = 20

Copyright © GrapeCity, inc. All rights reserved.