譬如说这段代码,已经含有一个datagridview了,可是他不响应的~~
To run this example, paste the code into a form that contains a DataGridView named dataGridView1 and ensure that all events are associated with their event handlers.
--------------------------------------------------
private void dataGridView1_CellEnter(object sender,
DataGridViewCellEventArgs e)
{
dataGridView1[e.ColumnIndex, e.RowIndex].Style
.SelectionBackColor = Color.Blue;
}private void dataGridView1_CellLeave(object sender,
DataGridViewCellEventArgs e)
{
dataGridView1[e.ColumnIndex, e.RowIndex].Style
.SelectionBackColor = Color.Empty;
}
To run this example, paste the code into a form that contains a DataGridView named dataGridView1 and ensure that all events are associated with their event handlers.
--------------------------------------------------
private void dataGridView1_CellEnter(object sender,
DataGridViewCellEventArgs e)
{
dataGridView1[e.ColumnIndex, e.RowIndex].Style
.SelectionBackColor = Color.Blue;
}private void dataGridView1_CellLeave(object sender,
DataGridViewCellEventArgs e)
{
dataGridView1[e.ColumnIndex, e.RowIndex].Style
.SelectionBackColor = Color.Empty;
}
this.Load += new System.EventHandler(this.NNAG01_Load);
事件关联吗?仅仅拷贝是不行的,必须建立事件关联才可以。