ProgressBar 的默认前景色
Default foreground color of ProgressBar
我一直在使用 System.Windows.Media
中的 Brush
和 Brushes
classes 从我的 C# 代码更改 ProgressBar
控件的前景色] 图书馆。但是,我想知道当我想恢复时,.Net 是否提供对 ProgressBar
的原始默认前景颜色的访问。
示例:
现在我正在引用@Beauty 在 this question that uses the SystemColors class 上提供的答案。 SystemColors
似乎是 .Net class 提供了控件的默认画笔颜色,但我没有看到 Progressbar
前景的画笔。这种颜色可以在 SystemColors
中获得,还是可以通过其他方式获得?
我如何改变颜色的一个例子:
XAML:
<ProgressBar Name="Progress" Foreground="{Binding LoadScreenModel.BarColor}" />
C#:
private Brush _barColor = Brushes.Red;
public Brush BarColor
{
get { return _barColor; }
set
{
_barColor = value;
NotifyPropertyChange(() => BarColor);
}
}
ProgressBar
控件的默认样式(在此 question and you can get it on MSDN 上找到)显示默认情况下的前景色是:
#FF01D328
这可能与系统颜色很匹配,但除此之外就使用它。
我一直在使用 System.Windows.Media
中的 Brush
和 Brushes
classes 从我的 C# 代码更改 ProgressBar
控件的前景色] 图书馆。但是,我想知道当我想恢复时,.Net 是否提供对 ProgressBar
的原始默认前景颜色的访问。
示例:
现在我正在引用@Beauty 在 this question that uses the SystemColors class 上提供的答案。 SystemColors
似乎是 .Net class 提供了控件的默认画笔颜色,但我没有看到 Progressbar
前景的画笔。这种颜色可以在 SystemColors
中获得,还是可以通过其他方式获得?
我如何改变颜色的一个例子:
XAML:
<ProgressBar Name="Progress" Foreground="{Binding LoadScreenModel.BarColor}" />
C#:
private Brush _barColor = Brushes.Red;
public Brush BarColor
{
get { return _barColor; }
set
{
_barColor = value;
NotifyPropertyChange(() => BarColor);
}
}
ProgressBar
控件的默认样式(在此 question and you can get it on MSDN 上找到)显示默认情况下的前景色是:
#FF01D328
这可能与系统颜色很匹配,但除此之外就使用它。