Right click to select row in dataGridView

前端 未结 4 2138
一个人的身影
一个人的身影 2020-12-29 10:31

I need to select a row in dataGridView with right click before ContextMenu shown because contextMenu is row-dependendt.

I\'ve tried this:

 if (e.Butt         


        
4条回答
  •  渐次进展
    2020-12-29 11:10

        private void grid_listele_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                grid_listele.ClearSelection();
                grid_listele[e.ColumnIndex, e.RowIndex].Selected = true;
            }
    
    
        }
    

提交回复
热议问题