Resizing a datagrid

N

Neil Robbins

Could anyone point me to information/examples of resizing the columns of a
datagrid especially when the datagrid itself is resized.

I currently have my DataGrid anchored so that it resizes to keep itself
occupying the same proportion of the form that it is situated within. What I
want though is for the columns to widen proportionately as well.

The alternative would be for them to auto-fit to fit the cell with the most
characters.

Any help would be, as always, much appreciated.

Neil R.
 
D

DraguVaso

I think you'll have to do this programmaticly: look at this, it will help
you for resizing the columns:
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q792q



To do this proportional: just recalculate your columnwidth in the
Resize-Event of the DataGrid
something like this:
MyDataGrid.TableStyles(0).GridColumnStyles(0).Width =DataGrid.Size.Width *
30 / 100 -> (30%)
MyDataGrid.TableStyles(0).GridColumnStyles(1).Width =DataGrid.Size.Width *
70 / 100 -> (70%)

Hope this is enough,

Pieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top