C#的ListView禁用水平滚动条 [英] C# ListView Disable Horizontal Scrollbar
本文介绍了C#的ListView禁用水平滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法可以阻止不断呈现在ListView了水平滚动条?我想在需要时垂直滚动条显示,但我想水平滚动条从不露面。
我会想象它会是与WndProc的<? / p>
感谢
解决方案
您可以尝试这样的事情,我用项目一旦和它的工作:
函数[DllImport(USER32)]
私人静态外部长ShowScrollBar(长HWND,长wBar,长bShow);
长SB_HORZ = 0;
长SB_VERT = 1;
长SB_BOTH = 3;
私人无效HideHorizontalScrollBar()
{
ShowScrollBar(listView1.Handle.ToInt64(),SB_HORZ,0);
}
希望它帮助。
is there a way I can stop the horizontal scroll bar from ever showing up in a listview? I want the vertical scroll bar to show when needed but I want the horizontal scroll bar to never show up.
I would imagine it would have something to do with WndProc?
Thanks
解决方案
You could try something like this, I used in a project once and it worked:
[DllImport ("user32")]
private static extern long ShowScrollBar (long hwnd , long wBar, long bShow);
long SB_HORZ = 0;
long SB_VERT = 1;
long SB_BOTH = 3;
private void HideHorizontalScrollBar ()
{
ShowScrollBar(listView1.Handle.ToInt64(), SB_HORZ, 0);
}
Hope it helps.
这篇关于C#的ListView禁用水平滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文