正文

不大使在不???????? 能否再问个初级问题??

(2009-01-07 21:27:34) 下一个
我runtime生成的datagridviewcolumn 为什么没有 border???

private void button2_Click(object sender, EventArgs e)
{
int intNumOfColumn = 8;
int gridsize = (int)Math.Floor((double)dataGridViewProcess.Size.Width / intNumOfColumn);
for (int intCounter = 0; intCounter < intNumOfColumn; intCounter++)
{
DataGridViewTextBoxColumn aDataGridViewColumn = new DataGridViewTextBoxColumn();
aDataGridViewColumn.Width = gridsize;
DataGridViewCellStyle myCellStyle = new DataGridViewCellStyle();
myCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
myCellStyle.WrapMode = DataGridViewTriState.True;

aDataGridViewColumn.DefaultCellStyle = myCellStyle;
aDataGridViewColumn.Resizable = DataGridViewTriState.False;
dataGridViewProcess.Columns.Add(aDataGridViewColumn);
}

myCellStyle;
for (int intCounter = 0; intCounter < intNumOfColumn; intCounter++)
{
DataGridViewRow arow = new DataGridViewRow();
arow.Height = 50;
dataGridViewProcess.Rows.Add(arow);
}
dataGridViewProcess.CellBorderStyle = DataGridViewCellBorderStyle.SunkenHorizontal;

dataGridViewProcess.Rows[3].Cells[0].Value = 33333333;
dataGridViewProcess.Rows[4].Cells[2].Style.BackColor = Color.Yellow;
}
[ 打印 ]
[ 编辑 ]
[ 删除 ]
阅读 ()评论 (0)
评论
目前还没有任何评论
登录后才可评论.