Click here to Skip to main content
16,020,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
anyone help me with this kind of problem....

What I have tried:

int width = 0;
           int height = 0;
           foreach (DataGridViewColumn col in dataGridView1.Columns) width += col.Width;
           foreach (DataGridViewRow row in dataGridView1.Rows) height += row.Height;
           dataGridView1.Size = new Size(width, height);
Posted
Updated 14-May-19 22:25pm

1 solution

Incorporating a panel inside a datagrid may not be a good idea.
You can play with the layout properties of your controls, instead. What if you set the DockStyle property of the datagrid to DockStyle.Top and add a panel below it with its DockStyle property set to DockStyle.Bottom? This is just a basic guess; proper layout depends on the whole collection of controls in your form, about which I have no knowledge.
 
Share this answer
 

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