简体   繁体   English

无法通过拖动边框来调整窗体大小

[英]Can't resize the form by dragging its borders

Form's AutoSize : False .表单的 AutoSizeFalse Form's AutoSizeMode : Grow and Shrink .表单的 AutoSizeMode增长和收缩

Issue: I cant resize my form by dragging its borders, I can only do that by dragging that grip thing on the bottom right side of the form.问题:我无法通过拖动边框来调整表单大小,我只能通过拖动表单右下角的手柄来实现。

Is there any other property on the form that I sohlud change to fix this problem?表单上是否有任何其他属性需要我更改以解决此问题?

Here is also a screen shot of the hierarchy of controls on the form...maybe setting on lower level controls on the form is causing this?这也是表单上控件层次结构的屏幕截图...也许是表单上较低级别控件的设置导致了这个?

在此处输入图像描述

Because this is not in the answers, I'll write this here. 因为这不在答案中,我会在这里写。

The problem seems to be caused by the form's AutoSizeMode being on GrowAndShrink, and not GrowOnly, which is the default setting. 问题似乎是由于表单的AutoSizeMode在GrowAndShrink上,而不是GrowOnly,这是默认设置。 Resetting to GrowOnly fixed the issue. 重置为GrowOnly修复了此问题。

(confirmed on MSVS2013 with .net 4.5 on Win7) (在Win7上使用.net 4.5在MSVS2013上确认)

确保将FormBorderStyle设置为Sizable,并将SizeGripStyle属性设置为Auto或Hide。

I have the same problem if maximum size was set. 如果设置了最大尺寸,我也会遇到同样的问题。 Please set it to 0 or to bigger than now. 请将其设置为0或大于现在。 After that you can move the border wherever you want. 之后,您可以在任何地方移动边框。 Change FormBorderStyle or SizeGripStyle can't help if maximum size is too small to new settings. 如果最大尺寸太小而无法进行新设置,则更改FormBorderStyleSizeGripStyle

int height = 960;
int width = 1280;
this.ClientSize = new System.Drawing.Size(width, height);

this way you can get a fixed form size...otherwise visual studio automatically changes it 通过这种方式,您可以获得固定的表单大小...否则,visual studio会自动更改它

Tried everything in the above (and Microsoft's forums) couldn't get it to resize. 尝试上面的所有内容(和微软的论坛)都无法调整大小。 Finally just opened another instance with a form I hadn't dorked up and compared. 最后刚刚打开另一个实例,其形式我还没有进行过比较。 Here's what needed set. 这是需要的设置。 All are mentioned above but not as a combination. 所有都在上面提到但不是组合。

In the form's property window (or in the code). 在窗体的属性窗口(或代码中)。

Autosize: False = allows resizing both dimensions (True = only width adjusted). 自动调整大小:False =允许调整两个尺寸(True =仅调整宽度)。

AutosizeMode: GrowOnly = allows both growing and shrinking. AutosizeMode:GrowOnly =允许增长和缩小。

FormBorderStyle: Sizeable. FormBorderStyle:大小。

I have the same problem, I can not manually change the size of form or controls in manual mode. 我有同样的问题,我无法在手动模式下手动更改窗体或控件的大小。 Tried all the above, checked prior forms in the project, I could resize them. 尝试以上所有,检查项目中的先前表格,我可以调整它们的大小。

Then, closed VS 2010, reopened the project, and I can resize the form and controls .... 然后,关闭VS 2010,重新打开项目,我可以调整表单和控件....

" Did you try the power switch ... ;)" “你试过电源开关......;)”

I finally figured out what was causing this for me.我终于弄清楚是什么导致了我。 This had been a problem for years, None of the things listed here helped, and indeed.多年来这一直是个问题,这里列出的所有事情都没有帮助,而且确实如此。 all of them were already set as suggested.所有这些都已按照建议设置。

It turned out that I couldn't make a window smaller in width if any control was anchored to the right edge, or smaller in height if any control was anchored to the bottom edge.事实证明,如果任何控件被锚定到右边缘,我不能使 window 的宽度更小,或者如果任何控件被锚定到底部边缘,我不能使高度更小。

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

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