dataGridView右键菜单并选中该行

it2022-05-09  27

程序代码: private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)        {            if (e.Button == MouseButtons.Right)            {                if (e.RowIndex >= 0)                {                    dataGridView1.ClearSelection();                    dataGridView1.Rows[e.RowIndex].Selected = true;                    dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];                    contextMenuStrip1.Show(MousePosition.X, MousePosition.Y);                }            }        }

转载于:https://www.cnblogs.com/hengbo/archive/2008/12/24/2232513.html

相关资源:数据结构—成绩单生成器

最新回复(0)