C#中form窗体的宽度和高度最大值限制

更新时间:2023-07-28 05:21:34 阅读: 评论:0

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

本文发布于:2023-07-28 05:21:34,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1121197.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:分辨率   电脑   地址   读取   绿色   窗体
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图