views:

205

answers:

1

In VB.net 3.5 SP1 I have a Windows Form with three DataGridView controls. One DGV takes up the whole bottom half of the form. The other two share the top half and are side-by-side.

I'd like to have each DataGridView scale appropriately. More specifically I'd like to have column widths and row heights adjust to the size of the form. Then I'd like the cell font to auto-fill based on a change in the cell size.

I've used the Dock property for the controls to scale to the size of the form. How can I get the rows and fonts to utilize the increased form size?

Thanks.

A: 

You can use the datagridview.autosizecolumns and the datagridview.autosizerows to autosize the columns and rows. Look at ColumnHeadersDefaultCellStyle, rowHeadersDefaultCellStyleand RowsDefaultCellStyle to change the font

As for changing the fontsize, I don't believe there is any automatic way to handle this. You'll just have to write some code to change the font size based on the size of the datagrid.

Aaron M