datagridview 设置随窗体改变大小,并自动改变列宽

private void SysLog_Load(object sender, EventArgs e) { this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.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))); dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }

你可能感兴趣的:(C#)