编程语言
首页 > 编程语言> > c#-突出显示滑块上的线段

c#-突出显示滑块上的线段

作者:互联网

我正在寻找一种在滑块/进度条上以黄色突出显示段的方法:

我发现一些文章讨论了如何使用样式构建自定义WPF滑块控件:

> http://codingsense.wordpress.com/2010/02/01/customize-a-slider-in-wpf-step-by-step-tutorial/
> http://codeblitz.wordpress.com/2009/06/12/wpf-control-templating/
> http://www.codeproject.com/Articles/36802/WPF-Colour-Slider

但是我需要以编程方式突出显示滑块上的给定段.

例如:

//Given:

List<Rectangle> rectangles; 

//And invoke

mycontrol.highlight(rectangles);

我该怎么办?更具体地说,如何在运行时在滑块上进行绘制?

解决方法:

在滑块中
属性IsSelectionRangeEnabled

If true, you can use a selection range to shade in a portion of the
slider bar. You set the position selection range using the
SelectionStart and SelectionEnd properties. The selection range
has no intrinsic meaning, but you can use it for whatever purpose
makes sense. For example, media players sometimes use a shaded
background bar to indicate the download progress for a media file.

标签:slider,progress-bar,wpf,c
来源: https://codeday.me/bug/20191201/2082395.html