Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a picture cell that displays and centers a picture within the 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);
// Change height of row to display the picture
m_Spread.SetRowHeight(3,27);
// Set the column width
m_Spread.SetColWidth(2,6);
// Define cell type as picture
m_Spread.SetCellType(CellTypePicture);
// Display the picture
// Convert hBitmap
CPictureHolder picture;
HBITMAP hBitmap = AfxGetApp()->LoadBitmap(IDB_CARD);
picture.CreateFromBitmap(hBitmap);
m_Spread.SetTypePictPicture(picture.GetPictureDispatch());
// Center the picture
m_Spread.SetTypePictCenter(TRUE);
// Set the cell's background color
// dark blue, RGB(0, 0, 128)
m_Spread.SetBackColor(0x800000);

Visual Basic

' Specify a cell
fpSpread1.Col = 2
fpSpread1.Row = 3
' Change height of row to display the picture
fpSpread1.RowHeight(3) = 27
' Set the column width
fpSpread1.ColWidth(2) = 6
' Define cell type as picture
fpSpread1.CellType = CellTypePicture
' Display the picture
fpSpread1.TypePictPicture = LoadPicture("C:\Samples\Files\CARD.BMP")
' Center the picture
fpSpread1.TypePictCenter = True
' Set the cell's background color
' dark blue, RGB(0, 0, 128)
fpSpread1.BackColor = &H800000&

Copyright © GrapeCity, inc. All rights reserved.