hii I am a fresher in the c # so i want to know how to resize the datagrid(any other control)aith respect to the form size. I just added one datagrid in the form then what i have to do?please help me...from the very basic please
Go to the properties window and scroll down to "Docking" and choose to dock the control in the parent container. This will give you various options about how you want the control to dock. You should put some containers in there of some sort, maybe, if you've got buttons or things you'd like to have show up above/below/next to the grid. Also, if your grid goes behind your other controls, select the control and bring it to the front.
edit:
You need some containers in which to put your buttons / drop-downs. You could use a flow-layout panel (which wouldn't resize its child controls), or you could use a plain panel or the table-layout panel. The table one will let you dock your child controls within each cell of the table, and you can set your columns & rows to auto-size to a percentage of the entire table width. That way everything will autosize accordingly.
You have to ways of dong it:
- Using a Dock. It works fine and is very easy to use but its limit is that you can stick it to a one side of parent container. So if you want to streach control only in width you will fail.
- Using Anchor. It require more configuration but you can specify all four(top, right, down, bottom option separably.
Regards Szymon
For a dynamic layout that scales with your form size you have various options (depending on the complexity of your layout).
The first ones are
But you can also work with advanced container controls like
Some more informations i already post in an older question.
If you have more concrete problems about how to solve a specific layout problem you should post a new question with your exact problem.
But at a first tip i can say that it is never necessary to use the Resize event and do some size changes on yourself. There is always a solution that can be solved with the above elements.