I'm having a problem using user controls with panels. When I load user control into the panel with the code:
panel3.Controls.Add(new userControl1());
it loads with the size of my initial usercontrol1 size. Actually, I have already made my form to maximize with this code.
this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea;
this.WindowState = FormWindowState.Maximized;
I also tried all the solutions I was able to find.
1- I tried to Dock
Fill
with the panel, user control, Anchoring to all sides.
2- Also did AutoSize = True
for user control and panel.
Nothing works at this point.
Actually, when I first time did load user control into the panel it loaded okay in my original project. then I don't know what happened. The image uploaded below is captured from the scratch new project. So, be sure it's not a problem with my original project either.