Hi @nope no ,
You can use the SizeChanged event to automatically size other controls.
The following code uses Form1_SizeChanged as an example to keep the button1 automatically scaled in equal proportion to Form1.
float firstWidth;
float firstHeight;
private void Form1_SizeChanged(object sender, EventArgs e)
{
float size1 = this.Size.Width / firstWidth;
float size2 = this.Size.Height / firstHeight;
SizeF scale = new SizeF(size1, size2);
firstWidth = this.Size.Width;
firstHeight = this.Size.Height;
button1.Font = new System.Drawing.Font(button3.Font.FontFamily, button3.Font.Size * ((size1 + size2) / 2));
button1.Scale(scale);
}
private void Form1_Load(object sender, EventArgs e)
{
firstWidth = this.Size.Width;
firstHeight = this.Size.Height;
}
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.