Centering a control on the form
The control is centered when the form is resized
Centering a control on the form
The control is centered when the form is resized
Text of videoReview the video on changing the location first.
private void Form1_Resize(object sender, EventArgs e)
{
//Center the label when the form is resized
int whiteSpace = this.Width - lblTitle.Width;
int left = whiteSpace / 2; //half of whitespace is on left, half on right
lblTitle.Location = new Point(left, lblTitle.Location.Y); //new value for X, Y stays the same
}