How to disable horizontal scrollbar for table panel in winforms

Nagu picture Nagu · Feb 4, 2010 · Viewed 22.1k times · Source

Hi I've a tablelayoutpanel and I'm binding controls to it dynamically. When the item count exceeds the height of panel obviously vertical scroll bar appearing there is no problem.

But the same time horizontal scroll bar is also appearing even the items width is less than the width of panel. How can i prevent this?

Answer

Pinaskee picture Pinaskee · Jul 2, 2011
int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;

tableLayoutPanel1.Padding = new Padding(0, 0, vertScrollWidth, 0);