datagridview 数据处理方法 修改 删除 添加 下拉类表 弹出窗口
}
}
private void dataGridView1_CurrentCellChanged_1(object sender, EventArgs e) {
// 当用户移动到性别这一列时单元格显示下拉列表框
try
{
if (dataGridView1.CurrentCell.ColumnIndex == 3)
{
Rectangle rect =
dataGridView1.GetCellDisplayRectangle(dataGridView1.CurrentCell.ColumnIndex,
dataGridView1.CurrentCell.RowIndex, false);
string sexValue = dataGridView1.CurrentCell.Value.ToString(); //MessageBox.Show(sexValue);
cmb_Temp.Text = sexValue;
cmb_Temp.Left = rect.Left;
cmb_Temp.Top = rect.Top;
cmb_Temp.Width = rect.Width;
cmb_Temp.Height = rect.Height;
cmb_Temp.Visible = true;
}
else
{
cmb_Temp.Visible = false;
}
}
catch
{
}
}
private void dataGridView1_CellDoubleClick(object sender,
DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{
DataGridView dgv = sender as DataGridView;
if (dgv.Rows[e.RowIndex].Cells[1].Value != null)
{