我如何禁用面板中的水平滚动条 [英] How do I disable the horizontal scrollbar in a Panel

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

问题描述

我有一个面板(Windows窗体),我想禁用的面板水平滚动条。我想这样的:

I have a panel (Windows Forms) and I want to disable a panels horizontal scrollbar. I tried this:

HorizontalScroll.Enabled = false;

但是,这是行不通的。

But that wouldn't work.

我怎样才能做到这一点?

How can I do this?

推荐答案

我想是因为你的面板的AutoScroll属性设置为true,你有这个问题。我做了一个测试解决方案(.NET 3.5),并发现了以下内容:

I think that you're having this problem because the AutoScroll property of your panel is set to true. I made a test solution (.NET 3.5) and discovered the following:

如果你试试这个:

panel.AutoScroll = true;
panel.HorizontalScroll.Enabled = false;
panel.HorizontalScroll.Visible = false;

在Horizo​​ntalScroll.Enabled和。可见的的更改为false(假设面板有一个原因自动滚动中的控件来显示水平滚动条)。看来你必须禁用自动滚屏,以能够手动改变周围这些属性。

the HorizontalScroll.Enabled and .Visible aren't changed to false (assuming the panel has controls within that cause autoscroll to show the horizontal scroll bar). It seems that you must disable AutoScroll to be able to change these properties around manually.

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

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