Zebra0.com

csharp arithmetic


Text of video
Review 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
}

End of lesson, Next lesson: