为什么在窗体里的Form1_Load里设置this.Location; 运行时窗体就会变大。
这个窗体本来就很小,开始调试时也会比设计大, 通过将MinimumSize属性设置为(1, 1). 运行时会有根设计视图中窗体一样的大小。
后来希望运行时将窗体显示在指定靠屏幕边缘的位置。所以在Form1_Load函数中增加了位置参数:
this.Location = new Point(this.Width, (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Height)/2);this.StartPosition = FormStartPosition.Manual;
Console.WriteLine(this.Location.X + "," + this.Location.Y + "," + this.Width + "," + this.Height); this.Location = new Point(this.Width, (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Height) / 2); this.StartPosition = FormStartPosition.Manual; Console.WriteLine(this.Location.X+ "," + this.Location.Y+ "," +this.Width+ "," +this.Height);