Kind of new to Windows Form development, but well-experienced in web development. Is there a way to assign a percentage width/height to a Windows Form control so that it expands/shrinks as the user resizes the window? It would be possible to write code to alter the width/height of the control as the window resizes, but I'm hoping there's a better way like in HTML/CSS. Is there?
In a word, no. You can easily do it programmatically in the Parent control resize event though. For example:
private void Form1_Resize(object sender, EventArgs e)
{
dataGridView1.Width = Convert.ToInt32(this.Width * 0.9);
dataGridView1.Height = Convert.ToInt32(this.Height * 0.9);
}
But if you can, use WPF as mentioned in the comments above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With