更新时间:2023-11-29 09:43:04
好吧,正如你问过这个问题一样,这可能会有效你创建了CellMouseEnter事件
Well, as you've asked the question, this 'might' work if you create the CellMouseEnter event
private void dataGridView1_CellMouseEnter(object sender,
DataGridViewCellEventArgs e)
{
DataGridViewCell cell =
this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
cell.Value = "";
}
但是,我不确定它是否真的需要(想要!=需要) - 如果你在datagridview周围挥动鼠标,这可能会消灭任何/所有细胞
经过一番想法我可能会错误地解释你所问的内容,因此,不是使用CellMouseEnter,而是将上述事件过程中的两行添加到SelectionChanged事件中 - 即
but, Im not sure if its what you actually NEED (want != need) - if you're waving the mouse around your datagridview, this could wipe out any/all cells
after some thought I might be mis-interpreting what you've asked, so, instead of using CellMouseEnter, add the two lines in the event procedure above to the SelectionChanged event - ie
private void dataGridView1_SelectionChanged(object sender,
DataGridViewCellEventArgs e)
{
DataGridViewCell cell =
this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
cell.Value = "";
}