There comes a scenario when you want to centralize the panel in Maximized Window State according to client's Screen Width and Height.
In the form Load Event:
private void frm_Load(object sender, EventArgs e)
{
Panel1.Location = new Point(
this.ClientSize.Width / 2 - Panel1.Size.Width / 2,
this.ClientSize.Height / 2 - Panel1.Size.Height / 2);
}
In the form Load Event:
private void frm_Load(object sender, EventArgs e)
{
Panel1.Location = new Point(
this.ClientSize.Width / 2 - Panel1.Size.Width / 2,
this.ClientSize.Height / 2 - Panel1.Size.Height / 2);
}
Happy Coding
No comments:
Post a Comment