C# Tips: 1.右键单击dataGrivdView选中该行并弹出菜单

来源:互联网 发布:qt 帮助文档linux 编辑:程序博客网 时间:2024/06/05 13:33
 

处理CellMouseDown事件

    if (e.Button == MouseButtons.Right)
            {
                if (e.RowIndex >= 0)
                {
                   
                    dataGridView2.ClearSelection();
                    dataGridView2.Rows[e.RowIndex].Selected = true;
                    dataGridView2.CurrentCell = dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    this.下拉菜单 .Show(MousePosition.X, MousePosition.Y);
                }
            }


        

原创粉丝点击