Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 表单以最小大小(仅显示标题栏)加载,而不是以与为其属性设置的值相对应的大小加载_C#_.net_Windows_Winforms_Size - Fatal编程技术网

C# 表单以最小大小(仅显示标题栏)加载,而不是以与为其属性设置的值相对应的大小加载

C# 表单以最小大小(仅显示标题栏)加载,而不是以与为其属性设置的值相对应的大小加载,c#,.net,windows,winforms,size,C#,.net,Windows,Winforms,Size,我有一个表单,其中包含一个停靠在顶部的菜单条,一个停靠在底部的状态条,以及一个停靠在上述控件之间的面板。我已将表单的属性设置为以下值: 在设计阶段: AutoScaleMode: Dpi AutoSize: false AutoSizeMode: GrowOnly DoubleBuffered: true SizeGripStyle: Show 在运行期间(在窗体的构造函数中): 我解决此问题的第一次尝试是修补AutoSize和AutoSizeMode属性,但我要求将其设置为上述值,因为更改这

我有一个表单,其中包含一个停靠在顶部的
菜单条
,一个停靠在底部的
状态条
,以及一个停靠在上述控件之间的
面板
。我已将表单的属性设置为以下值:

在设计阶段:

AutoScaleMode: Dpi
AutoSize: false
AutoSizeMode: GrowOnly
DoubleBuffered: true
SizeGripStyle: Show
在运行期间(在窗体的构造函数中):

我解决此问题的第一次尝试是修补
AutoSize
AutoSizeMode
属性,但我要求将其设置为上述值,因为更改这些值将不允许用户调整表单大小。我尝试的另一种方法也失败了,就是将上述控件的
AutoSize
属性设置为
false
,以强制表单的子容器不调整大小

提前谢谢

有关表格的PS截图:

计算表单大小时出现(错误)数字错误,如语句
(显示设计阶段的横向分辨率/横向分辨率的宽度)
(显示设计阶段的纵向分辨率/纵向分辨率的高度)
返回不能存储为整数的浮点值

有关声明如下:

this.Size=new Size(Convert.ToInt32(Screen.GetWorkingArea(this.Location).Size.Width*(Convert.ToDouble(widtowindowedesignphase)/Convert.ToDouble(displayindesignphase的水平分辨率))、Convert.ToInt32(Screen.GetWorkingArea(this.Location).Size.Height*(Convert.ToDouble(heheightowindowdesignphase)/Convert.ToDouble(显示在设计阶段的垂直分辨率);

// Calculate the default size of the window on the basis of the ratio of the dimensions of the window to the dimension of the screen resolution of the machine used in development as the default dimensions of the window is aligned to that of the machine used to design it    
this.Size = new Size(Screen.GetWorkingArea(this.Location).Size.Width * (widthOfWindowInDesignPhase /horizontalResolutionOfTheDisplayInDesignPhase), Screen.GetWorkingArea(this.Location).Size.Height * (heightOfWindowInDesignPhase / verticalResolutionOfTheDisplayInDesignPhase)); 
this.MinimumSize = new Size(this.Size.Width, this.Size.Height);