CenterScreen works for me in all applications I ever developed. Maybe you set not to CenterScreen but to CenterParent? That does not work. More I can not say without knowing your code.
Definately CenterScreen, was working then somewhere along the line. I have also tryed:
[code]this.Location = new Point(((Screen.GetBounds(this).Width - this.Width)/2), ((Screen.GetBounds(this).Height - this.Height)/2));
I have same problem... C# application with some wizard based forms... in properties I set start position to CenterScreen but it opens in upper left corner... not completely at 0,0 but in upper left.
I tried the suggestion of adding the code to the function InitForm...no change.
I looked at InitComponent and there is a line of code there also setting start position to Center Screen.
public static DialogResult ShowDlg( Form parent )
{
var dlg = new Form2( ) { Owner = parent };
return dlg.ShowDialog( );
}
In the Form2 properties, set the StartPosition property to CenterParent.
In a button handler of Form1, call the static ShowDlg method and pass in the 'this' member.
Code:
private void button1_Click( object sender, EventArgs e )
{
if( DialogResult.OK == Form2.ShowDlg( this ) )
{
// do something here when the OK button has been clicked
}
}
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.