Answers for "c# center windows form"

C#
1

c# center windows form

// Do not call CenterToScreen() directly from your code. Instead,
	// Use somthing like this

	//-- After InitializeComponent()
	InitializeComponent();

	//-- Center Screen - Multi Monitor Support
	Rectangle workingArea = Screen.FromControl(this).WorkingArea;
	this.Location = new Point()
    {
      X = Math.Max(workingArea.X, workingArea.X + (workingArea.Width - this.Width) / 2),
      Y = Math.Max(workingArea.Y, workingArea.Y + (workingArea.Height - this.Height) / 2)
    };
Posted by: Guest on February-25-2021
0

how to align a form in the center c# forms

protected void CenterToScreen ();
Posted by: Guest on July-28-2020

C# Answers by Framework

Browse Popular Code Answers by Language