scorpion1974
Programmer
I am developing a Windows Control Library application in C#.I have several controls on my form and I want all the controls to resize when my form gets resize.Does anybody know how to do that?
Thank you.
Thank you.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
private void CMDForm_Resize(object sender, System.EventArgs e)
{
Control control = (Control)sender;
// Force the Form to square (Height = Width).
if(control.Size.Height != control.Size.Width)
{
control.Size = new Size(control.Size.Width, control.Size.Width);
}
}
private void CMDForm_Layout(object sender, System.Windows.Forms.LayoutEventArgs e)
{
// Force the Form in the center of the screen
this.SetBounds((Screen.GetBounds(this).Width/2) - (this.Width/2),(Screen.GetBounds(this).Height/2) - (this.Height/2), this.Width, this.Height, BoundsSpecified.Location); // BoundsSpecified.All
}