简体   繁体   English

ProgressBar的默认前景色

[英]Default foreground color of ProgressBar

I've been changing the foreground color of the ProgressBar control from my C# code using the Brush and Brushes classes from the System.Windows.Media library. 我一直在使用System.Windows.Media库中的BrushBrushes类从C#代码更改ProgressBar控件的前景色。 However, I'm wondering if .Net provides access to the original default foreground color of the ProgressBar for when I want to revert back. 但是,我想知道.Net是否可以访问ProgressBar的原始默认前景色,以便在我想要还原时。

Example: 例:

在此输入图像描述

Right now I'm referencing an answer provided by @Beauty on this question that uses the SystemColors class. 现在我在这个使用SystemColors类的问题上引用@Beauty提供的答案。 SystemColors seems to be the .Net class that provides the default brush colors of controls, but I don't see a brush for the foreground of a Progressbar . SystemColors似乎是.Net类,它提供控件的默认画笔颜色,但我没有看到一个用于Progressbar前景的画笔。 Is this color obtainable in SystemColors , or is there some other way of getting it? 这种颜色是在SystemColors获得的,还是有其他方法可以获得它?

An example of how I am changing colors: 我如何改变颜色的一个例子:

XAML: XAML:

<ProgressBar Name="Progress" Foreground="{Binding LoadScreenModel.BarColor}" />

C#: C#:

private Brush _barColor = Brushes.Red;

public Brush BarColor
{
    get { return _barColor; }
    set
    {
        _barColor = value;
        NotifyPropertyChange(() => BarColor);
    }
}

The default style for the ProgressBar control (found on this question and you can get it on MSDN ) reveals that the foreground color by default is: ProgressBar控件的默认样式(在此问题上找到,您可以在MSDN上获取)显示默认情况下前景色为:

#FF01D328 #FF01D328

That may well match up with a system color, but otherwise just use that. 这很可能与系统颜色匹配,但只是使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM