C# Windows 窗体 ListView 缺少水平滚动条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/727366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Windows Forms ListView missing horizontal scrollbar
提问by Cade Roux
I have a Windows Forms ListView in a form (C#, VS 2005) and have it anchored to all the edges of the form so that it entirely fills the form excluding the status bar. The ListView is in detail mode and the columns are very wide - definitely wider than the display area. I have a vertical scrollbar but no horizontal scrollbar.
我有一个窗体(C#,VS 2005)中的 Windows 窗体 ListView,并将它锚定到窗体的所有边缘,以便它完全填充窗体,不包括状态栏。ListView 处于详细模式并且列非常宽 - 绝对比显示区域宽。我有一个垂直滚动条,但没有水平滚动条。
I can scroll to the left and right with the keyboard when the control has the focus, but I cannot get the scrollbar to display.
当控件具有焦点时,我可以使用键盘向左和向右滚动,但无法显示滚动条。
Scrollable is set to true.
可滚动设置为 true。
What am I missing?
我错过了什么?
采纳答案by Jhonny D. Cano -Leftware-
It looks like the status bar is hiding the horizontal scroll bar, besides than changing the Dock property to Fill, you can check whether:
看起来状态栏隐藏了水平滚动条,除了将 Dock 属性更改为 Fill 之外,您还可以检查是否:
- Add a SplitContainer and arrange the Controls inside of them
- Modify your Status Bar's Dock to bottom
- Add a FlowLayoutPanel and put your Controls inside of it.
- 添加一个 SplitContainer 并在其中安排控件
- 将状态栏的 Dock 修改为底部
- 添加 FlowLayoutPanel 并将您的控件放入其中。
Hope these tips be useful
希望这些提示有用
回答by Adam Robinson
Rather than anchoring it to all four sides to fill the area, try setting the Dock
property to Fill
.
与其将其锚定到所有四个边以填充该区域,不如尝试将该Dock
属性设置为Fill
。
回答by Samuel
If Scrollable
was set to false
, you wouldn't be able to scroll with the keyboard, so the status bar must be hiding the scrollbar from you.
如果Scrollable
设置为false
,您将无法使用键盘滚动,因此状态栏必须对您隐藏滚动条。
What you can do it set the listview's dock to Fill
or shrink the listview a little to not go under the status bar.
您可以做什么将列表视图的停靠Fill
栏设置为或稍微缩小列表视图以不进入状态栏下方。
回答by Noam Geffen
Had the same problem with the status bar hiding the horizontal scroll bar of an ImageBox (emgu) seem that the order of placing the GUI elements is important here. place the ListView / ImageBox after you place the status bar and it will work like a charm.
与隐藏 ImageBox (emgu) 的水平滚动条的状态栏有同样的问题,似乎放置 GUI 元素的顺序在这里很重要。放置状态栏后放置 ListView / ImageBox,它会像魅力一样工作。