//添加下面事件即可
        private void DataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    this.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true;
                   
                }
            }
        }
posted on 2007-12-14 12:01  shf  阅读(1684)  评论(2编辑  收藏  举报