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

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_DROPDOWNLIST style and no CBS_OWNERDRAW* I am having trouble changing the apparent height.
Question: How can I change the apparent height of such a DROPDOWNLIST combobox?
I am aware that the combobox does not allow changing the height with SetWindowPos. I was however under the impression that sending a CB_SETITEMHEIGHT message with wParam= -1 should modify the height. This method does work for comboboxes with the CBS_OWNERDRAWFIXED style set (I wanted to avoid setting this style though to preserve the "button-like" look).
Environment: My Win32 application uses Common-Controls 6.0 and I am concerned about the appearance in an environment where visual styles are enabled (Windows 7, Aero).

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.

Related

Scale all control to window size

I have a dialog based application which contain controls such treectrl,listsctrl and group box contain all the buttons control. I am working in Visual Studio 2010 Professional Edition.All controls are placed in the Dialog at design time and no control is created at run time.
Using
int desktopW = GetSystemMetrics(SM_CXVIRTUALSCREEN);
int desktopH = GetSystemMetrics(SM_CYVIRTUALSCREEN);
got the width and height of window, then found the relative position of the controls.
Using SetWindowPos try to change the width and height of various control, if new width and height is less than old control width and height.
But that involves a lot of calculation.
Is there exist any easy way to change the control position/scaling based on window size?
Use Dynamic Layout for the controls.
See the Properties of each control. Then by using the Moving Type and Sizing Type properties you can specify how the control must move and/or resize as the dialog frame resizes.

How to properly use sizing with Cocoa

ALL,
NSSmallControlSize page has following explanation:
This constant is for controls that cannot be resized in one direction,
such as push buttons, radio buttons, checkboxes, sliders, scroll bars,
pop-up buttons, tabs, and progress indicators. You should use a small
system font with a small control.
Is there any way to set the size for other controls? Namely NSComboBox.
Unfortunately the documentation is not talking about that. It's not even mentioning if it is at all possible.
TIA!
As the page describes, the constant is for controls that cannot be resized in one direction. Combo boxes, like the listed controls, cannot be resized vertically. Therefore it makes sense that the constant would apply to combo boxes.
This can be quickly verified by creating a combo box in Interface Builder, clicking on the Size inspector, and setting its size to Small. Since this works, we can conclude that the small size is compatible with combo boxes.

QComboBox display height in macOS

I have a QComboBox that I want to display both icons and text. As such, I need to set the height of the combo box to be at least the height of the icons - I was thinking around 32px, but that is flexible. Unfortunately, under macOS 10.12 at least (pretty sure I've had the same problem on older releases as well, however), I can't seem to change the height of the combo box at all, with the result that the icon of the currently selected item overflows the combobox display.
I've tried both setting the stylesheet for QComboBox to add a height attribute, as well as setting the minimumSize height property on the widget itself, but unfortunately the only effect so far has been to add space around the combo box - as though it is larger, even though it isn't. How can I get the combo box height to change on macOS? Thanks.
The native combo box on OS X doesn't support this :( Qt's mac style could support it, making it look less-native, but alas it doesn't. You must either make your icons smaller, or restyle the combo from scratch to approximate how an imaginary upsized native combo would look.
On Windows and Linux I personally set the height of combobox with this stylesheet, maybe it will work on macOS :
QComboBox QAbstractItemView::item{
min-height: 60px;
}
And then in the code I change the item delegate
ui->comboBox->setItemDelegate(new QStyledItemDelegate());
The result :

How to see controls which are below the bottom of screen in designer

I have a StackPanel in ScrollViewer with many TextBlock+TextBox (so on the screen I see same scrolling list view like in phone's standard Settings page).
In VS's or Blend's designer is it any simple way to see controls which are bellow the bottom of screen? (I need some kind of scrolling in designer). It must be something simple. Now I am switching off visibility of upper controls to see lower controls and it is boring.
Change the d:DesignHeight to a larger value, such as 2000 (the maximum height), and Expression Blend will allow you to see content that otherwise would require scrolling.
Example screenshot

How do you change the height of a SketchFlow ComboBox?

SketchFlow allows for the changing of the Height property for the TextBox and ListBox controls. However, I seem to be unable to change the Height property for a ComboBox. The Height property can be changed in the Properties window but it has no effect (at design or run time).
You shuold open sketchstyles.xaml in notepad or visual studio. Then find the style for combobox-sketch. You will find 2 places(once in outermost grid definition and another in the end) of min-height in the style, set them both to what you want.
Are you sure you have the combobox item selected in the Objects and Timeline panel? I tried this and it works fine for me. Are you able to resize it using the mouse and adorners?

Resources