Hi all..
I am displaying a form from thread. I set its startposition property to centreparent but its displayed on topleft corner.. I am displaying form using...
error_msg.ShowDialog();
//where error_msg is object of form
Please help me to solve this problem..
Loading

try abcPosted Jul 4, 2008, 1:09 AM
Thanks for reply but its not working such .
I also tried with
Point p = new Point(parentform.Left + parentform.Width/2 , parentform.Top + parentform.Height / 2);
but problem is it gives parentform.left=0..............
Scott LyslePosted Jul 3, 2008, 10:02 AM
That is the the behavior you get when adding a child form to a parent. You can get passed that by changing the location of the child form on the child form's load event.
Try this:
private void frmChild_Load(object sender, EventArgs e)
{
Point p = new Point(this.ParentForm.Width / 2 -
this.Width/2,
this.ParentForm.Height / 2 - this.Height/2);
this.Location = p;
}