Jump to content
PLC Forum


C# il Form al centro del video.


Recommended Posts

Pacifico437
Posted

Buongiorno,

benchè alla proprietà del Form inserisco: "CenterScreen", noto che il Form rispetto al video è  inerito verso l'alto.

ho usato il seguente codice con esito negativo e gradirei un suggerimento per risolvere.
Anticipatamente ringrazio e fiducioso, saluto.
Domenico.

int x, y;
 x = (this.Width - Form1.Width) / 2; 
 y = (this.Height - Form1.Height) / 2;
 Form1.Location = new Point(x, y);

 


Posted

Ciao,

strano: this.StartPosition = FormStartPosition.CenterScreen; a me funziona senza problemi, sia impostato da codice che dall'editor grafico.

In ogni caso, se vuoi utilizzare this.Location = new Point(x, y); devi prima impostare this.StartPosition = FormStartPosition.Manual;

 

Buon lavoro.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...