开发者

How to center vertically items on Toolstrip (Flow mode)?

开发者 https://www.devze.com 2023-02-21 18:53 出处:网络
In my Winforms application I have a toolbar that contains many items (buttons with icon 32px, labels and comboboxes).

In my Winforms application I have a toolbar that contains many items (buttons with icon 32px, labels and comboboxes).

I decided to set the Toolstrip.LayoutStyle property from the default HorizontalStackWithOverflow to Flow in order to allow the toolbar split automatically on more rows when user have a very low resolution monitor or he/she resize the window.

The prob开发者_运维问答lem is that all labels and comboboxes are aligned to the top of Toolstrip when I change the LayoutStyle.

Does exist a property or any other workaround that allow me to center them vertically?


I think I see what you mean, the label isn't as tall as, say, a button. And it gets aligned improperly with LayoutStyle = Flow. Ugh. You can work around it by changing the Padding property of the label. To do this properly, you should however do this in the form's OnLoad() method override, the label will be taller when you run on a machine with a higher video DPI setting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号