自动适应屏幕大小而自动调整窗体内控件的位置大小设置dock属性或anchor属性
以dataGrid1为例
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
或
this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
你也可在设计器里直接设置
以dataGrid1为例
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
或
this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
你也可在设计器里直接设置
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货