轨迹栏上的值
快速提问; 在 C#、Windows 窗体中,是否不可能让 System.Windows.Forms.TrackBar 在其刻度旁边显示其所有值? 我还没有找到任何方法来做到这一点,这让我有点惊讶。 还有其他方法可以实现这种行为吗?我真的很想避免创建 25 个标签并在上面书写。
Quick question;
In C#, Windows Forms, is it not possible, to have a System.Windows.Forms.TrackBar show all its values, next to its ticks?
I have not been able to find any way of doing this, which suprises me abit.
Is there another way, to get this behavior? I really would like to avoid, creating 25 labels, and writing on them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过创建其中包含 TrackBar 的用户控件并在运行时生成标签来实现此目的(标签的位置根据刻度值进行)。
我前段时间用 ProgressBar 而不是 TrackBar 做了类似的事情,但逻辑应该仍然适用。恐怕现在手头没有代码,我会尝试挖掘它。
You can achieve this by creating a User Control with the TrackBar in it and generate labels at runtime (placement of the labels goes according to tick values).
I did something similar some time ago with a ProgressBar instead of TrackBar, but the logic should still apply. Don't have code at hand right now I'm afraid, will try to dig it up.