3

I have 4 Dev Express Grid Columns (Two are not visible) I'am trying to make the visible Columns like :

this.DataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

I tried the following :

 gridView2.Columns["MyColumnB"].BestFit();

It works fine but is there is anyway so It dosen't get Width more then GridControl and don't get that Horizental ScrollBar ?

Sorry , Fixed using :

 gridView2.OptionsView.ColumnAutoWidth = true;
B17
  • 558
  • 1
  • 6
  • 21
user3451838
  • 31
  • 1
  • 3

1 Answers1

1

Try this code which will tell the grid view to never display the horizontal scroll bar, then create the best fit columns for the entire grid view, instead of just doing so for a specific column.

gridView2.HorzScrollVisibility = ScrollVisibility.Never;
gridView2.BestFitColumns();
B17
  • 558
  • 1
  • 6
  • 21