检查滚动条可见性
有没有办法检查垂直滚动条在某个 ListView 对象上是否可见?
我有一个带有 listView 的 Windows 窗体,在调整大小事件中,我想捕获列表视图是否有可见的垂直滚动条!
Is there a way to check if the Vertical Scroll Bar is visible on a certain ListView object?
I got a Windows Forms with a listView on it, on the resize event i would like to catch if the listview has its Vertical Scroll Bar visible!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这是 WPF 示例存在,它位于解决方案的基础上,连接到
ListView.LayoutUpdated
。如果这是 WinForms,您可以使用 pinvoke 和 GetWindowLong...
VB 代码存在 使用
GetWindowLong
检查 ScrollBar 是否存在移植到 C#。If this is WPF a sample exist here which at the base of the solution hooks on to
ListView.LayoutUpdated
.If this is WinForms you could make use of pinvoke and GetWindowLong...
VB code exists using
GetWindowLong
to check if a ScrollBar exist which you could port to C#.我在使用 Winforms 时使用了几种方法,这些方法基于我想要从中获取该信息的控件类型。这是我的班级。
假设在您的用例中您有一个分割面板,并且您希望左侧面板足够宽而没有水平滚动条,那么您可以这样做:
我并不是说这是最好的方法,我只是说这是一个选项,特别是在处理不同 DPI 的多个显示器时
I have several methods that I use when using Winforms that are based on what type of control I would like to get that information from. Here is my class.
Say in your use case you have a splitter panel and you would like to have the left panel wide enough not to have a horizontal scrollbar then you could do this:
I'm not saying it's the best way, I just say it's an option, especially if dealing with several monitors in different DPI