我有一个面板,可以动态添加控件。我希望能够将所有面板居中放置在面板上,因为目前它们都粘在左侧
我读到我们必须将小组和所有小组分开,但我必须承认我一无所知。有人可以帮我,让我全心吗?
谢谢。
在VS Designer中,尝试将Anchor和Dock属性设置为None。然后,控件将放置在中间。
Anchor
Dock
None
编辑:另外,您可以迭代这些控件并设置其Control.Location.X += (Parent.Width - Control.Width / 2);
Control.Location.X += (Parent.Width - Control.Width / 2);