tags:

views:

133

answers:

1

Any combo box I create seems to be stuck at 12 dialog units in height. Microsoft's guidelines for spacing and sizing of controls in dialog boxes state that a combo box should be 14 dialog units high.

I have even tried editing the resource file in notepad and recompiling in Visual Studio without opening the resource editor - but the combo boxes are still the wrong size!

Any ideas?

A: 

You can get the combo components HWNDs and sizes with WTL::CComboBox::GetComboBoxInfo(), for instance in your OnInitDialog():

COMBOBOXINFO cbi = {sizeof COMBOBOXINFO}; 
CComboBox(GetDlgItem(ID_MYCOMBO)).GetComboBoxInfo(&cbi);
CRect rComboEdit = cbi.rcItem;
// adjust rComboEdit to your needs
CEdit(cbi.hwndItem).MoveWindow(rComboEdit);

cheers, AR

Alain Rist
This doesn't work either -- MoveWindow will only affect the position and width, the height stays the same.
Hamish Morrison
Sorry:( , use ATL::CWindow::SetWindowPos() instead of ATL::CWindow::MoveWindow()
Alain Rist
Behaviour is the same with SetWIndowPos... I guess this is just a bug with the ComboBox. What bothers me though, is that Microsoft recommends that ComboBoxes be 14 DLUs tall, and this isn't even possible through the Win32 API. Oh well, thanks for trying.
Hamish Morrison
Try the same without theme, it should work.
Alain Rist