tags:

views:

350

answers:

2

I've made a simple MFC application (Visual Studio 2008, dialog based) and added a CComboBox using the resource editor. I used the resource editor to specify the dropdown height. Then I added some code to add 100 texts to the combobox. If I run this simple application the dropdown height is ignored. If I disable the Microsoft.Windows.Common-Controls 6.0.0.0 style (disable the pragma that adds it to the manifest file) then everything works fine.

Has anyone noticed this behaviour (and knows a solution)? I've searched the web and msdn, but no luck so far.

A: 

The difference is the "new" Common-Controls-6.0-style Combo-box, or the "original" old-style Combo-box (pre 6.0).

I guess Microsoft finally "fixed" the ComboBox control so it dynamically changes the height of the drop-down according to the number of items and the screen real-estate available, which is better than having a fixed height (IMHO).
Unfortunately I have no source for that, just wild guessing :)

fretje
I agree that it's better to look at the number of items and available space, but a maximum drop height is useful in 'my' case (well, according to the users of my program) :-)
crimson13
+1  A: 

The only solution I've found (thx to someone on the Microsoft MFC newsgroup) is to use the CBS_NOINTEGRALHEIGHT flag that states that the combobox must look to the exact size specified by the user rather then adjusting it automatically (the reason this is a patch is that the flag is normally intended to disable the feature where the dropheight is adjusted so that no partial items are rendered).

crimson13