Auto size the controls in winform

我的未来我决定 提交于 2019-12-04 01:15:25

问题


I've a winform and I placed a listbox in that form. When I maximize the winform the size of the list box remains same.

But I dont want like this. I want to adjust the size automatically.

Is there any default property for this?

Thank you, Nagu


回答1:


Look for the anchor properties. You can set the anchor to resize automatically following the form.

The anchor has 4 sides. If you anchor to all 4 sides, the control will retain its size ratio according to the size of its parent form.




回答2:


Use the .Anchor property.




回答3:


You can set the Dock Property of the listbox to fill. if you are using list box in some parent control like splitter panel



来源:https://stackoverflow.com/questions/1623746/auto-size-the-controls-in-winform

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!