Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a form I have a datagridview which has a contents of my xml file. I am opening a popup settings window to on cell right click. Here popup setting window is a another form.

I have written a code for opening a popup setting window form. but it is showing on the topmost corner of the screen. how to set the location of the popup setting window form below the currentcell in a datagridview.

What I have tried:

C#
private void dataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
 if (e.Button == MouseButtons.Right)
  {
private frmDGVColList objform = new frmDGVColList();
objform.StartPosition = FormStartPosition.Manual;
objform.Location = dataGridView1.PointToScreen(dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location);
objform.Show(this.dataGridView1);
}
}
Posted
Updated 9-Apr-18 2:44am
v2

1 solution

 
Share this answer
 
Comments
Poornima Santhosh 9-Apr-18 8:48am    
I have tried its not working
RickZeeland 9-Apr-18 8:51am    
Did you also modify your popup form like this ?

private Point loc;
public Form2(Point location)
{
InitializeComponent();
loc = location;
}

private void Form2_Load(object sender, EventArgs e)
{
this.SetDesktopLocation(loc.X, loc.Y);
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900