简体   繁体   中英

How to make Windows Forms UserControl auto-resizing to docked content?

I have a UserControl which I'm going to place into a DevExpress PopupControlContainer .

I want the UserControl to auto-size to fit at least its content, which is a PanelControl containing two buttons, docked to the bottom, and a ListBoxControl docked to fill the rest.

The UserControl's and panel's AutoSize property is True and while it is not docked, it also behaves correctly and does not shrink past its content. The UserControl also does not shrink past the panel while it is not docked.

But I want the panel to be docked to the bottom while still restricting the UserControls minimum width so that its content stay completely visible.

How can I achieve this?

像这样在创建UserControl对象时影响Dock属性:

UserControl myUserControl= new UserControl () { Dock = DockStyle.Fill };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM