Objective: (This is not an MDI application) Display a child
form containing a datagridview that contains the child records of the selected
row in a datagridview. Have this display on a parent form right below the
selected row in the datagridview.
Problem: I am unable to get the correct location of the cursor on the parent
datagridview control passed to the child form so the child form displays
correctly.
I am passing the location to the constructor of the child form so that I can
call this child form as you would call ContextMenu.Show(DataGridView, e.X, e.Y)
but I am not sure how the Point gets set to the Control and not the parent
form. When I use e.X and e.Y. I am successful in displaying the child form
related to the parent form coordinates but not the control
Any help would be greatly appreciated.
Thanks
Tim

display a form at selected mouse coordinates
Saskia1
Cyberflight
I thought of that last night as well but when I tried it this morning I still don't get the desired results.
Here is the snipits I am using for testing.
MAIN FORM:
private void dgvPreAuditData_MouseUp(object sender, MouseEventArgs e)
{
LaunchChildGrid(e.X, e.Y);
}
private void LaunchChildGrid(int xPoint, int yPoint)
{
ChildGrid myChild = new ChildGrid(dgvPreAuditData, xPoint, yPoint);
myChild.ShowDialog(this);
}
CHILD FORM:
public ChildGrid(Control parent, int xPosition, int yPosition)
{
_xPosition = xPosition;
_yPosition = yPosition;
_parent = parent;
InitializeComponent();
PositionMe();
}
private void PositionMe()
{
Point ParentPoint = new System.Drawing.Point(_xPosition, _yPosition);
this.Location = ParentPoint;
}
Jens Köhler
Hi,
Have you changed the StartPosition property of the child form to 'Manual' This is essential to make it appear at selected position on the parent form. Let me know if the problem persists even after you have done this.
-Mamta