Hi,

I have a form which has the property
StartPosition set to Center Screen

It works, but if I change the property

FormBorderStyle to something, the Center Screen property stops working?

Why is this happening?

Thanks in advance

>FormBorderStyle to something, the Center Screen property stops working?

Please post that code here.

I change these properties in the properties windows of visual studio.

The funny thing is that it will work if I put Sizeable in the FormBorderStyle.

Any other property will not make the form appear in the center of the screen.

Any ideas?

Try this code,

Form2 frm = new Form2();
 frm.StartPosition = FormStartPosition.CenterScreen;
 frm.Show();

Well,

It is the main form, it is the one that appears when I run the program, the other forms and dialogs appear at the center of the screen and they have propertie of the border changed, I don't know why this is not appearing at the center.

THanks

Hi,

I fixed it puting before InitializeComponente() the code you told me like this:

this.StartPosition = FormStartPosition.CenterScreen;

It is odd that changing the property from the Visual Studio graphical interface did not work.

Thanks

From MSDN Docs:

The FormBorderStyle, MinimizeBox, and MaximizeBox properties allow you to control whether the form can be minimized, maximized, or resized at run time.

The FormBorderStyle property has an affect on size and location of your form. Sizable is the default setting. Here is a link to the documentation for the property, it may give some clues as to why the form behaves this way when setting this property.

This question has already been answered. Start a new discussion instead.