Posted on 2004-08-26
I have a windows forms application and I am using C#
I have a main form which acts as a menu. When the user clicks on a menu option I want to open a new form but this new form to be the same size and position as the main form so that if the use has moved the form around the screen it will be tidy and look like there is just one form open as they are on top of each other.
I achieved this by calling my form as follows:
private void btnSearch_Click(object sender, System.EventArgs e)
Forms.frmSearch objSearchForm = new Forms.frmSearch();
objSearchForm.Visible = false;
objSearchForm.Left = this.Left;
objSearchForm.Top = this.Top;
objSearchForm.Visible = true;
This does work ok but the screen flashes as the window is moving from its original location to the new one.
I guess I must be doig this the wrong way. Any thoughts on how to stop the flashing or a right way to do this. I tried setting the Left and Top before calling Form.Show but this didn't work.