olibara 0 Newbie Poster

Hello

I'm trying to set the focus to a DGV and move the mouse to that DGV
But the position seems to be related to the sreen area not the active form area

Here is the code I'm using

private void HandMade_Click(object sender, EventArgs e)
    {
      dgv_X.Focus();
      int X = dgv_X.Left + dgv_X.Width / 2;
      int Y = dgv_X.Top + dgv_X.Height ;
      Cursor.Position = new Point(X, Y);
    }