Reputation: 3
I create a form and set a specific size and when I run the program the displayed form doesn't match the previously set size.
For example I create a form and I add a panel with size 100x100. Then I set the size of the form to 200x200. When I start the program the displayed form should be 200x200 and the panel should occupy exactly 1/4 of it but here this clearly isn't the case.
public class Form1 : Form
{
public Form1()
{
Panel actionPanel = new Panel();
actionPanel.Size = new Size(100, 100);
actionPanel.BackColor = Color.Red;
Size = new Size(200, 200);
Controls.Add(actionPanel);
}
}
(https://i.sstatic.net/Q76pw.jpg)
Upvotes: 0
Views: 19