How to accurately locate pop up form besides a cell
When mouse enters a cell, I need to pop up a form just besides the cell, like, the top left of the form is at the bottom right of the form.
But the following code doesn't work, where the form appear radomly..
How to do it right?
vb.NET Code:
Private Sub m_dgvBasicDataGrid_CellMouseEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles m_dgvBasicDataGrid.CellMouseEnter
Dim pt As System.Drawing.Point
Dim rect As Rectangle = m_dgvBasicDataGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, True)
pt = New System.Drawing.Point(rect.Right, rect.Bottom)
Form2.Location = pt
Form2.Visible = True
End Sub
Re: How to accurately locate pop up form besides a cell
Make sure the form's 'StartPosition' property is set to 'Manual'.