Question

I'm trying to open a contextmenustrip at the place where I right-clicked the mouse, but it always shows at top left of the screen.

Here is the code I used:

private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
    if (e.Button == MouseButtons.Right)
    {
        contextMenuStrip1.Show(new Point(e.X,e.Y));
        doss.getdossier(connection.conn, Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value));
    }
}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top