Defines a cell's attributes.
C
BOOL WINAPI SftBox_GetCellInfo(HWND hwndCtl, LPSFTBOX_CELLINFOPARM lpCellParm); BOOL WINAPI SftBox_SetCellInfo(HWND hwndCtl, LPCSFTBOX_CELLINFOPARM lpCellParm);
C++
BOOL CSftBox::GetCellInfo(LPSFTBOX_CELLINFOPARM lpCellParm) const; BOOL CSftBox::SetCellInfo(LPCSFTBOX_CELLINFOPARM lpCellParm);
hwndCtl
The window handle of the combo box control.
lpCellParm
A pointer to a SFTBOX_CELLINFOPARM structure which holds the required parameters.
The return value is TRUE if the function is successful, otherwise FALSE is returned.
The GetCellInfo and SetCellInfo functions define a cell's attributes.
To modify a cell's attributes, the GetCellInfo function is used to retrieve its current attributes. The SFTBOX_CELL structure, part of the SFTBOX_CELLINFOPARM structure, can then be modified, setting the desired attributes. Finally, the cell is updated by a call to the SetCellInfo function.
Cell text can be retrieved using GetText and modified using SetText.
In a fixed height combo box control, all cell pictures used for all cells must be the same size. In a variable height combo box control, cell pictures can be of varying sizes. The (largest) cell picture size must be registered using SetCellInfo.
A cell may have an associated cell picture without the picture actually being visible. The cell picture doesn't become visible until the cell picture size has been registered using SetCellInfo by setting the index member of the SFTBOX_CELLINFOPARM structure to -1. Only one picture is used to register the picture size. After registering the picture size, any number of pictures may be used. A new picture size can be registered at any time, but in a fixed height combo box control, all cell pictures in use must be replaced by pictures of the new size.
Pictures are owned by the application and the associated bitmap, icon or ImageList handles have to remain valid as long as the combo box control uses them. Handles have to be deleted by the application once they are no longer needed.
Fonts are owned by the application and the associated font handles have to remain valid as long as the combo box control uses them. Fonts have to be deleted using DeleteObject once they are no longer needed.
In a combo box control using a virtual data source, SetCellInfo can only be used to register the cell picture size. Cell attributes cannot be modified.
lpCol->colorBgEnd = lpCol->colorBgSelEnd = SFTBOX_NOCOLOR;
lpCol->colorProgress = lpCol->colorProgressEnd = SFTBOX_NOCOLOR;
lpCol->realPos = lpCol->dispPos = position;
}
static void SetColorSample(HWND hwndBox, LONG index, COLORREF color)
{
// The color sample is the picture of the cell in the first column.
SFTBOX_CELLINFOPARM CellInfo;
memset(&CellInfo, 0, sizeof(CellInfo));
CellInfo.index = index;
CellInfo.iCol = 0;
SftBox_GetCellInfo(hwndBox, &CellInfo);
Sft_SetPictureColorSample(&CellInfo.Cell.CellPicture1, SAMPLE_SIZE, SAMPLE_SIZE, color, SYSCOLOR(COLOR_WINDOWTEXT));
SftBox_SetCellInfo(hwndBox, &CellInfo);
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_BACKGROUND, m_Background);
DDX_Control(pDX, IDC_TEXT, m_Text);
}
void CMainDlg::SetColorSample(CSftBox& box, LONG index, COLORREF color)
{
// The color sample is the picture of the cell in the first column.
SFTBOX_CELLINFOPARM CellInfo;
memset(&CellInfo, 0, sizeof(CellInfo));
CellInfo.index = index;
CellInfo.iCol = 0;
box.GetCellInfo(&CellInfo);
Sft_SetPictureColorSample(&CellInfo.Cell.CellPicture1, SAMPLE_SIZE, SAMPLE_SIZE, color, SYSCOLOR(COLOR_WINDOWTEXT));
box.SetCellInfo(&CellInfo);See Also C/C++ API | Categories | Notifications