0
votes

I'm using Visual Studio 2008. I have a DatagridView which contains four columns. I need:

to display the horizontal scrollbar in order to see all these columns and to display the last column so that it fills my datagridview To display the horizontal scrollbar I've set the ScrollBar property to Horizontal and used this code:

 _formMain.GridCol_Name.Frozen = true;
 _formMain.GridCol_Info.Frozen = true;
 _formMain.DataCol_Position.Frozen = false;
 _formMain.GridCol_Visibility.Frozen = true;

To show the last column so that it fills the remaining space in DatagridView I have used this code:

 _formMain.Grid_NonAnatObj.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;       
 _formMain.GridCol_Info.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

The problem is that the second code sample "removes" the horizontal trackbar.

How can I solve this problem? Thank you

1
winforms, unfortunately :)Martina
Check every single data coloumn and make sure frozen is set to false because if 1 is true then it won't work in the layout propertyZoomVirus

1 Answers

1
votes

MSDN says:

The width available for fill mode is determined by subtracting the widths of all other columns from the width of the client area of the control. If this width is smaller than the combined MinimumWidth values of all fill-mode columns, the horizontal scroll bar is displayed, all fill-mode columns are shown with their minimum widths, and user column-resizing is disabled.

Try tweaking your MinimumWidth of the columns