I have a windows application that run in full screen and there are some panels inside my form which I want they stretch in width, I mean how i can add width=100% to these panel?
As you see in the below image, right panel is my inner one(container panel) that should stretch, it contains many items: 2 panels, toolstrip and a grid. I just set the Doc="Fill" and Anchor="top; right; left; bottom" to it but nothing changed.
By dragging either the right edge, bottom edge, or the corner, you can resize the form.
If you'd like to resize it to a particular size, you can do it on the code behind: Size panelSize = new Size(500, 500); usercontrol1. Parent.
Right click on your form and go to properties. Then go to Layout options,see there are a property named Size. Change it as your need as width and length wise.
Remarks. This property enables you to set the starting position of the form when it is displayed at run time. The form's position can be specified manually by setting the Location property or use the default location specified by Windows.
To make the panel stretch to the whole of the form change the Anchor
property of the panel control and set it to all four of them. Resize the control to stretch to the whole of the form.
panel1.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;
Secondly for making a form fullscreen:
this.WindowState = FormWindowState.Maximized;
this.FormBorderStyle = FormBorderStyle.None;
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