我需要在Windows窗体中增加最大尺寸(高度) [英] I need to increase max size (Height) in my windows Form
问题描述
朋友,
如何在Windows应用程序中更改表单的最大大小.
在我的应用程序中,有几个控件,默认情况下它们不能修复
的最大大小
形式.我想特别增加表格的长度..
如果可能的话,有可能吗?
谢谢与问候
Honey4U
Hi Friends,
How i can change the max size of form in windows application.
In my application several control are there , they are not fix by default max size of
forms. I want to increase especially length of the form..
is it possible, if possible how??
Thanks & Regards
Honey4U
推荐答案
该表单具有一个名为max length的属性
the form has a property named max length
为澄清这个问题并为您提供帮助,我们需要知道:
1.您的屏幕分辨率.
2.为什么不通过使用锚点"和停靠"之类的属性来调整控件的大小以适合您的可用屏幕空间的原因
忽略将WinForm的大小(和/或最大大小)属性设置为大于当前屏幕分辨率的观察将被忽略,并且将使用当前可用的屏幕大小是正确的.如果在代码中设置了大小,则大小自动限制"将在设计时...和运行时同时发生.
OriginalGriff向您指出,获取更多像素的一种方法是将屏幕分辨率更改为更高的分辨率.
但是请记住,您可以在Forms中创建大于最大Form大小或屏幕大小的对象.
例如,我现在的最大屏幕尺寸约为1300x788,但是我可以创建一个Panel 3000x2000,将其添加到WinForm中,确保没有设置将其绑定到Form边界的Anchor或Dock属性.我可以将这个巨大的面板部分或完全置于屏幕之外.
而且我可以编写代码来单击并拖动该面板,以便该窗体在该面板上充当视口".
...编辑#1 ...您可以使用UserControl做同样的事情:
To clarify this question, and help you, we need to know:
1. your screen resolution.
2. why you are not focusing on re-sizing the controls to fit your available screen space by using properties such as ''Anchor and ''Dock
The observation that setting the size (and/or maximum size) property of a WinForm larger than the current screen resolution will be ignored, and the current screen size available will be used is correct. This "auto-limit" of Form size will take place both at Design-Time ... and at Run-Time, if you set the Size in code.
OriginalGriff has pointed out to you that one way to get more pixels is to change your screen resolution to a higher resolution.
But do keep in mind that you can create objects inside Forms that are larger than the maximum Form size, or screen size.
For example, my maximum screen-size right now is about 1300x788, but I can create a Panel 3000x2000, add it to a WinForm, make sure it has no Anchor or Dock property set that will bind it to the Form boundaries; I can position this giant Panel partially or fully off the screen.
And I can write code to click and drag that panel around so that the Form is functioning as a "viewport" on that Panel.
... edit #1 ... you can do the same thing with a UserControl:
UserControl1 uc1 = new UserControl1();
uc1.Dock = DockStyle.None;
uc1.Anchor = AnchorStyles.None;
uc1.MaximumSize = new Size(1500, 1200);
uc1.MinimumSize = new Size(1500, 1200);
uc1.Size = new Size(1500, 1200);
uc1.Location = new Point(-1000, -900);
this.Controls.Add(uc1);
uc1.Show();
在这种情况下面板或UserControls是否可以满足您的需求:我不知道.
无论如何,最好对您的这些太大"的控件有更多的了解:它们是什么:可以将它们放在某个可以让您滚动它们的容器中吗?依此类推.
Whether Panels or UserControls would meet your needs in this scenario: I don''t know.
In any case it would be good to know more about these controls of yours that are "too big:" what are they : can they be put in some container that will let you scroll them ? And so forth.
您需要将新值分配给System.Windows.Forms.Form.MaximumSize
.不是Size
,Width
或Height
.
—SA
You need to assign new value toSystem.Windows.Forms.Form.MaximumSize
. NotSize
,Width
orHeight
.
—SA
这篇关于我需要在Windows窗体中增加最大尺寸(高度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!