用于输入一系列值的组件(类似于轨迹栏)
我需要一个用于输入范围的组件。我正在沿着带有两个标记的轨迹栏的思路思考。是否有专门用于此目的或可以轻松模拟它的“本机 Delphi”组件?
I need a component for entering ranges. I was thinking along the lines of a trackbar with two markers. Are there "native Delphi" components that are meant for this purpose or that can simulate it easily?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我花了几分钟写了这样的:
还有一些需要改进的地方,例如1) 添加键盘界面,2) 使标记的显示可选并添加更多外观设置,4) 对齐到整数网格,以及
3) 添加按数字输入值的功能尝试双击点击拇指!该控件在启用和不启用视觉主题的情况下均可工作,并且完全双缓冲。
I got a few minutes over and wrote this:
There are still a few things to improve, such as 1) add keyboard interface, 2) make the display of the markers optional and add more appearance settings, 4) snap to integer grid, and
3) add the ability to enter a value by numbersTry double-clicking a thumb!.The control works both with and without visual themes enabled and is completely double-buffered.
除了Andreas'很好的答案和组件之外,还有另一个滑块组件,能够:
(来源:NLDelphi.com)
In addition to Andreas' nice answer and component, hereby another slider component that is capable of:
(Source: NLDelphi.com)
我不知道有这样的事情,尽管可能有这样的事情。我担心将一个标记移到另一个标记之上的可用性问题。当我在应用程序中询问范围时,我只是要求用户输入数字。
I don't know of anything like this, although there probably is such a thing. I'd be concerned about the usability issues of moving one of the markers on top of the other. When I ask for ranges in my app I just ask the user to type the numbers in.
TTrackBar 有 SelStart、SelEnd 和 ShowSelRange。然而它们似乎没有多大用处——如果有主题并且用户无法移动 Sel* 标记,它们几乎是不可见的。
TTrackBar has SelStart, SelEnd and ShowSelRange. However they don't seem to have much use - they are nearly invisible if themed and AFAICT the user can't move the Sel* markers.
我建议进行一对旋转编辑。如果用户愿意,可以单击向上/向下,但大多数人只想输入其值:
I suggest a pair of spin edits. The user can click up/down if they want to but most people will just want to enter their values: