Combo Box Height

Started by
3 comments, last by des3d 23 years, 9 months ago
Hi All, Does any knows how to change the Height of the Combo Box? e.g h_Main = CreateWindow ( AppName, "Access Calculator v1.1", WS_CHILD, 0, //x coordinate 0, // y coordinate 100, //width 50, //height <---this is only for the drop down height hwnd, NULL, hInstance, NULL); Thanks in advance! DES3D
Advertisement
please..



(Taken from the Win32 API docs..)

An application sends a CB_SETITEMHEIGHT message to set the height of list items or the selection field in a combo box.

To send this message, call the SendMessage function with the following parameters.

SendMessage(
(HWND) hWnd, // handle to destination window
CB_SETITEMHEIGHT, // message to send
(WPARAM) wParam; // item index
(LPARAM) lParam; // item height
);

Parameters
wParam - Specifies the component of the combo box for which to set the height. This parameter must be –1 to set the height of the selection field. It must be zero to set the height of list items, unless the combo box has the CBS_OWNERDRAWVARIABLE style. In that case, the wParam parameter is the zero-based index of a specific list item.

lParam - Specifies the height, in pixels, of the combo box component identified by wParam.

Return Values
If the index or height is invalid, the return value is CB_ERR.

Remarks
The selection field height in a combo box is set independently of the height of the list items. An application must ensure that the height of the selection field is not smaller than the height of a particular list item.

// CHRIS

// CHRIS [win32mfc]
I haven''t tested this, but try:

SendMessage(myComboBox, CB_SETITEMHEIGHT, (WPARAM) -1, (LPARAM) height);
Thanks a lot you two!

This topic is closed to new replies.

Advertisement