I want to put a gap between menustrip and form at right of menuStrip. I used autosize= false and new size properties, height of menustrip is changed but width is not changed. Menustrip's width remain same with form's width.
menuStrip2.AutoSize = false;
menuStrip2.Size = new Size(50, 90);
I can not change from Desing-> Properties -> Size, too.
I only create a gap from menustrip's right to form's left.
Here's how you do this at design-time:
Create a new form.
place two panels on this form. Call them panelTop
and panelFill
. Set there dock properties to Top
and Fill
respectively. Resize panelTop
to the height you want you menu strip to be.
Add another panel to panelTop
, call it panelTopRight
. Dock this panel Right
.
Add your menu strip. Set the dock property to fill.
Right click on panelTopRight
and 'Send to Back'. Now you can resize the panelTopRight
to allow the gap that you require.
If you want to do this at run-time you will have to perform all of the above in code; but that is perhaps another question...
I hope this helps.