A combo box control determines the height of its items in one of two ways. Depending on the window style SFTBOXSTYLE_VARIABLE, which is specified when the combo box is created, a variable height or a fixed height combo box is created. The window style cannot be changed once the combo box has been created.
In a fixed height combo box, all items have the same height. SftBox/DLL determines the best height for all items by analyzing the default font (WM_SETFONT), the number of text lines (SetItemLines), the registered cell picture size (SetCellInfo), the registered label picture size (SetItemLabelPicture), the registered item picture size (SetItemPicture, SetPictures), the expand/collapse buttons, the tree line style (SetTreeLineStyle), the grid lines (SetShowGrid), the 3D display mode (SetShow3D), the row header font (SetRowHeaderFont), the registered row header picture size (SetRowInfo) and the number of row header text lines (SetRowHeaderLines). Components that are not used are not considered.
Cell fonts (SetCellInfo) are not considered. If a cell font is used in a fixed height combo box, the application must ensure that the cell font is not larger than the default font.
All label pictures must be the same height and width, as must all item pictures, all cell pictures and all row header pictures. The size of each type of picture is registered once, by calling the function with an item index of -1.
An application can override the height of all items using SetItemHeightMinMax with an item index of -1. If the minimum and maximum height are set to the same value, all items have exactly this height.
SftBox_SetItemHeightMinMax(hwndBox, -1, 24, 24); /* all items are 24 pixels high */In a variable height combo box, items have varying heights. The height of each item is calculated individually and recalculated as its attributes change. This requires additional processing, so the window style SFTBOXSTYLE_VARIABLE should only be used when items of varying height are needed.
SftBox/DLL determines the best height for each item by analyzing the default font (WM_SETFONT), the cell font and cell picture of each cell (SetCellInfo), the number of text lines (SetItemLines) and the word wrap style of each column (SetColumns), the item's label picture (SetItemLabelPicture), the item's item picture (SetItemPicture), the expand/collapse buttons, the tree line style (SetTreeLineStyle), the grid lines (SetShowGrid), the 3D display mode (SetShow3D), the row header font (SetRowHeaderFont), the item's row header picture (SetRowInfo) and the maximum number of row header text lines (SetRowHeaderLines). Components that are not used are not considered.
An application can override the height of an individual item using SetItemHeightMinMax with the item's index. A minimum or maximum of 0 lets the combo box determine the height. When a virtual data source is used, the minHeight and maxHeight members of the SFTBOX_ITEM structure are used instead.
In a variable height combo box, a column using word wrap (SFTBOX_WRAP) can cause the height of items to change when the user resizes the column (see Multi-Line Cell Text).
GetItemHeight returns the height of an item in the dropdown portion. With an item index of -1, it returns the height used to display the selected item in the static portion or edit control portion. GetItemHeightMinMax returns the minimum and maximum height defined using SetItemHeightMinMax.
A dropdown combo box or dropdown list combo box adjusts its own window height so that the selected item and the column headers (if shown) fit exactly. In a variable height combo box, the height of the combo box can therefore change as another item is selected. The window styles SFTBOXSTYLE_ALIGNBOTTOM and SFTBOXSTYLE_ALIGNCENTER define whether the bottom edge or the center of the combo box remains in place when its height changes, otherwise the top edge remains in place. The parent window receives the SFTBOXN_SIZECHANGED notification when the size of the combo box has changed.