如何在WinForms中禁用表格面板的水平滚动条 [英] How to disable horizontal scrollbar for table panel in winforms

查看:98
本文介绍了如何在WinForms中禁用表格面板的水平滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个tablelayoutpanel,我正在动态绑定控件.当项目数超过面板高度时,显然会出现垂直滚动条,这没有问题.

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?

推荐答案

int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;

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

这篇关于如何在WinForms中禁用表格面板的水平滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆