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
None of these solution worked in every case; I ended up needing a combination of them:
public void hideHorizontalScrollBar(ref TableLayoutPanel pan)
{
if (!pan.HorizontalScroll.Visible)
return;
pan.Padding = new Padding(0, 0, 0, 0);
while (!!pan.HorizontalScroll.Visible || pan.Padding.Right >= SystemInformation.VerticalScrollBarWidth * 2)
pan.Padding = new Padding(0, 0, pan.Padding.Right + 1, 0);
}
Important: this can be called once on form load, but must also be called in the layout resize event.