C#中form 窗体的宽度和⾼度最⼤值限制
C#中⼀个form的宽/⾼度的最⼤值,不能⽐它所运⾏的电脑上的屏幕的分辨率多于12 pixel 。所以程序中要先读取电脑的分辨率,再做判断。
csdn原⽂地址和从该地址拷贝的内容:
Form.Size Property
共建绿色家园Gets or ts the size of the form.
尝的成语
Namespace: Asmbly: System.Windows.Forms (in System.Windows.Forms.dll)
Property Value
Type:
A that reprents the size of the form.
This property allows you to t both the height and width (in pixels) of the form at the same time instead of tting the and properties individually. If you want to t the size and location of a form, you
can u the property to size and locate the form bad on desktop
假期工coordinates or u the property of the class to t the size and location of the form bad on screen coordinates.
The following code example demonstrates how to create a form that is displayed with an opacity level of 75 percent. The example code creates a new form that is positioned in the center of the screen with an property t to change the opacity level of the form. The example code also ts the Size property to provide a larger sized form than the default size of the form. This example requires that the method defined in this example is called from another form in an event handler or other method.
良好的学习习惯
Framework (current version)public Size Size { get ; t ; }
private void CreateMyOpaqueForm()
{
// Create a new form.
Form form2 = new Form();
// Set the text displayed in the caption.大锅
form2.Text = "My Form";
// Set the opacity to 75%.
form2.Opacity = .75;青春期功血
// Size the form to be 300 pixels in height and width.
鹅仙洞
form2.Size = new Size(300,300);
/
/ Display the form in the center of the screen.
form2.StartPosition = FormStartPosition.CenterScreen;
// Display the form as a modal dialog box.
突发脑溢血
form2.ShowDialog();
}
Framework
Available since 1.1