gpt4 book ai didi

C# WPF : slider going to exact position

转载 作者:可可西里 更新时间:2023-11-01 07:50:17 28 4
gpt4 key购买 nike

我在 WPF 窗口中使用 slider ,我希望当用户单击 slider 轨道上的某处时,拇指会转到该确切位置。目前,当我点击某个地方时,拇指会指向那个位置,但不会正好那个位置。我怎样才能实现我想要的?

编辑:一个更好地解释我想要什么的例子:如果拇指位于 10 并且我在 100 附近按下鼠标,我希望它跳到 100 (不通过其他值)。

最佳答案

您需要将 IsMoveToPointEnabled 设置为 True:http://msdn.microsoft.com/en-us/library/system.windows.controls.slider.ismovetopointenabled.aspx

Slider.IsMoveToPointEnabled Gets or sets a value that indicates whether the Thumb of a Slider moves immediately to the location of the mouse click that occurs while the mouse pointer pauses on the Slider track.

关于C# WPF : slider going to exact position,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18018920/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com