How to change the apparent height of a Combobox control with the dropdownlist but not ownerdraw style?

前端 未结 1 1366
借酒劲吻你
借酒劲吻你 2021-01-19 16:46

Background: In a certain dialog there are several controls in a row. I would like all of them to have the same apparent height. However for a combobox with the CBS_DROPDOWNL

相关标签:
1条回答
  • 2021-01-19 17:32

    I don't think this is possible.

    As you mention, neither SetWindowPos nor MoveWindow work like you expect. That's because the height of a ComboBox includes the height of the drop-down. The control automatically resizes itself according to the size of the font it uses. So to change the size, change the size of the control's font by sending it a WM_SETFONT message.

    But I don't understand why this is a problem. You say that you want a series of controls to have the same height, but unless you're changing the height of the other controls, they should already match. Since all controls on a dialog generally use the same font, combo boxes and text boxes should all have the same height already. When you use v6 of the common controls and Visual Styles are enabled, they'll be applied to all of these controls and they should have a uniform appearance. You shouldn't have to mess with the heights manually.

    0 讨论(0)
提交回复
热议问题