如何在 C# 中使 winforms 进度条垂直移动?
我正在开发 WinForms Jukebox。
我想要一个垂直的进度条来控制音量。
有谁知道这是怎么做到的吗?
I'm working on a WinForms Jukebox.
I'd like to have a vertical ProgressBar for the volume control.
Does anyone know how to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道我会使用进度条来控制音量,但要显示音量级别,您可以使用用户绘制的控件,或者只需调整大小带有背景颜色的标签(尽管最后一种方法有点笨拙)
进度条并不意味着接受输入,无论方向如何。
如果您确实想控制音量,请考虑使用垂直滚动条或带有垂直方向。
对于它的价值,有 MSDN 上关于如何创建垂直进度条的讨论,他们建议这样做:
在
Style
中设置PBS_VERTICAL
标志。I don't know that I'd use a progress bar to control the volume, but to display the volume level you could use a user drawn control or you could just resize a label with a background color (that last method is kind of kludgy though)
The progress bar isn't meant to take input, no matter what the orientation.
If you really would like to control the volume, consider using a vertical scroll bar, or a trackbar with a vertical orientation.
For what it's worth, there's a discussion on how to create a vertical progress bar on MSDN, where they suggest doing this:
which sets the
PBS_VERTICAL
flag inStyle
.为此,您必须使用 ProgressBarRenderer。 它记录在 MSDN
文档实际上显示了实现垂直进度条,所以它应该让你很容易。 :-)
You have to use the ProgressBarRenderer for that. It's documented in MSDN
The documentation actually shows implementation of a vertical ProgressBar, so it should make it easy for you. :-)