posts - 7,  comments - 3,  trackbacks - 0
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);
                }

            }

        }
posted on 2009-08-11 16:28 老虎爱吃鱼 阅读(690) 评论(0) 编辑 收藏
(评论功能已被博主禁用)