Click here to Skip to main content
15,070,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have mdi form which has child. In child form, I created panel programmely ,I found the size of the panel does not fit the size of it form ,I want to stretch the panel as the size of the form (both should be stretch in same time) could i do that  

What I have tried:

Panel mypanel=new Panel();
//then i have used the property of panels lik this

Updated 4-Aug-21 0:34am

1 solution

As you have said "mdi" (bit old fashioned there) I will assume WinForms. Sounds like you need
- Control.Anchor Property (System.Windows.Forms) | Microsoft Docs[^] and/or
- Control.Dock Property (System.Windows.Forms) | Microsoft Docs[^]
Engineer khalid 4-Aug-21 7:21am
this.pnl.Anchor= (AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900