怎么写方法,感谢
5 个解决方案
#1
void dataGridView_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView.RowCount >= 2 && dataGridView.ColumnCount >= 2)
{
if (dataGridView.CurrentCell.RowIndex == 1 && dataGridView.CurrentCell.ColumnIndex == 1)
{
object cellValue = dataGridView[1, 1].Value;
dataGridView[2, dataGridView.CurrentCell.RowIndex].Value = cellValue;
}
}
}
{
if (dataGridView.RowCount >= 2 && dataGridView.ColumnCount >= 2)
{
if (dataGridView.CurrentCell.RowIndex == 1 && dataGridView.CurrentCell.ColumnIndex == 1)
{
object cellValue = dataGridView[1, 1].Value;
dataGridView[2, dataGridView.CurrentCell.RowIndex].Value = cellValue;
}
}
}
#2
用当前单元格变更时的哪个事件...
dataGridView1_CurrentCellChanged 查看e.rowindex 与dgv1.currentcell.index LZ试下是否可以得到效果
dataGridView_CellMouseLeave 这个事件无法兼顾到键盘操作吧...
dataGridView1_CurrentCellChanged 查看e.rowindex 与dgv1.currentcell.index LZ试下是否可以得到效果
dataGridView_CellMouseLeave 这个事件无法兼顾到键盘操作吧...
#3
CellMouseLeave +1
#5
#1
void dataGridView_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView.RowCount >= 2 && dataGridView.ColumnCount >= 2)
{
if (dataGridView.CurrentCell.RowIndex == 1 && dataGridView.CurrentCell.ColumnIndex == 1)
{
object cellValue = dataGridView[1, 1].Value;
dataGridView[2, dataGridView.CurrentCell.RowIndex].Value = cellValue;
}
}
}
{
if (dataGridView.RowCount >= 2 && dataGridView.ColumnCount >= 2)
{
if (dataGridView.CurrentCell.RowIndex == 1 && dataGridView.CurrentCell.ColumnIndex == 1)
{
object cellValue = dataGridView[1, 1].Value;
dataGridView[2, dataGridView.CurrentCell.RowIndex].Value = cellValue;
}
}
}
#2
用当前单元格变更时的哪个事件...
dataGridView1_CurrentCellChanged 查看e.rowindex 与dgv1.currentcell.index LZ试下是否可以得到效果
dataGridView_CellMouseLeave 这个事件无法兼顾到键盘操作吧...
dataGridView1_CurrentCellChanged 查看e.rowindex 与dgv1.currentcell.index LZ试下是否可以得到效果
dataGridView_CellMouseLeave 这个事件无法兼顾到键盘操作吧...
#3
CellMouseLeave +1