Form1 自动滚动 = 垂直滚动

发布于 2024-08-04 08:22:30 字数 50 浏览 4 评论 0原文

我启用了自动滚动,但无法出现水平滚动条。谁能帮我通过自动滚动仅激活表单上的垂直滚动条?

I have autoscroll enabled BUT I can't have horizontal scrollbars appear. Can anyone please help me to only activate vertical scrollbars on the form with Autoscroll?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乄_柒ぐ汐 2024-08-11 08:22:30
Form.HorizontalScroll.Enabled = false;

应该摆脱它。


有趣的是,看起来我说应该摆脱它是对的。搜索了一下,这似乎是 Winforms 中一个已知且未修复的错误。 此页面意味着如果您不介意在 user32 中调用一些非托管代码,则可能有某种方法可以做到这一点,但看起来最好的选择就是确保所有控件都适合表单宽度(通过对接或锚定它们)因为滚动条是根据需要添加的。

抱歉误导您了。

Form.HorizontalScroll.Enabled = false;

Should get rid of it.


Interesting, looks like I was right when I said should get rid of it. Searching around it looks like this is a known and unfixed bug in Winforms. This page implies that there may be some way to do it if you don't mind pinvoking some unmanaged code in user32, but it looks like the best bet is simply to ensure that all your controls fit inside the form width (by docking or anchoring them) since the scrollbars are added as required.

Sorry for misleading you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文