简体   繁体   English

调整Windows窗体的大小不会调整内部组件的大小

[英]Resizing a windows form does not resize inner components

I had to touch windows forms again and I am having some hard time figuring out something which should be very easy to fix. 我不得不再次触摸Windows窗体,并且我很难找出一些应该很容易修复的东西。

I've got this control: 我有这个控制:

控制

which when I place in a form looks like this: 当我放置在表单中时,它看起来像这样:

控制

The problem is that when running the form this is how the control place on it looks: 问题在于,运行表单时,控件的外观如下:

控制

I set the anchor property in all the component with the control, so I am not sure what the problem it. 我用控件在所有组件中设置了anchor属性,所以我不确定是什么问题。 The control should resize its components when the form is resized but that is not happening. 调整窗体的大小后,控件应该调整其组件的大小,但那没有发生。

Any help will be more than welcome. 任何帮助都将非常受欢迎。

Marco 马可

You'll need to set Dock property to Fill on your containers. 您需要将Dock属性设置为在容器上Fill I'm not quite sure the structure of your layout, I use TableLayout or Panels, set Dock to fill on that, so that is stretched with the main window. 我不太确定布局的结构,我使用TableLayout或Panels,将Dock设置为填充,以便与主窗口一起拉伸。 And inside of the container I place my components, again set to Dock where appropriate. 然后将我的组件放入容器内,并在适当的地方再次设置为Dock。

Ok this is a weird issue. 好的,这是一个奇怪的问题。 I changed the font in the form to Verdana and forgot to change it in the Control as well, and this is what was causing the issue. 我将窗体中的字体更改为Verdana,但也忘记了在Control中进行更改,这就是导致此问题的原因。 Maybe it has to do with the way fonts are rendered. 可能与字体的呈现方式有关。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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