Win Forms DataGridView 水平滚动条
是否可以在 Windows Forms 2.0 中永久显示 DataGridView 的水平滚动条。就像我们可以在面板的水平滚动条中所做的那样。
目前,只有当列的宽度总和大于 DataGridView 宽度时,Horizontal ScrollBar 才可见。但我希望这个滚动条始终可见。
谢谢
Is it possible to show permanently the horizontal scroll bar of a DataGridView in Windows Forms 2.0. Like we can do in the horizontal scroll bar of a Panel.
Currently, the Horizontal ScrollBar is visible only when the total sum of widths of the columns is bigger than the DataGridView width. But I want this scroll bar to be always visible.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

正如评论中提到的,DataGridView 控制其滚动条,并且如果不需要查看它们,则始终希望隐藏它们,例如,所有单元格都适合网格的可见区域。
但是,有一种方法可以强制 DataGridView 使用反射显示其滚动条,尽管这是一种 hack,我不建议这样做。下面是一个例子:
希望这有帮助,问候
As it was mentioned in comments DataGridView controls its scrollbars and always wants to hide them if there is no need in viewing them, e.g. all cells fit into grid's visible area.
However, there is a way to force DataGridView to show its scroll bars using reflection, though it's a hack and I wouldn't recommend doing this. Below is an example:
hope this helps, regards