vb.net中的DataGridView 标题列如何居中
在vb.net 中 如何将DataGridView 中的标题列居中
[解决办法]
这样试试看:
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = SystemColors.Control;
dataGridViewCellStyle1.Font = new Font( "宋体 ", 9F, System.Drawing.FontStyle.Regular, GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
[解决办法]
DataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter