[英]Storing colors in WPF applications
I'm upgrading an old WinForms application to WPF and is wondering how to store a color in WPF? 我正在将旧的WinForms应用程序升级到WPF,并且想知道如何在WPF中存储颜色?
In Winforms I had: 在Winforms中,我有:
public System.Drawing.Color Color { get; set; }
But in WPF the Color-class doesn't exist. 但是在WPF中,颜色类不存在。 How do you achieve the same thing in WPF?
您如何在WPF中实现同一目标?
Thanks in advance! 提前致谢!
In WPF, You can use Color like this: 在WPF中,可以使用如下颜色 :
public System.Windows.Media.Color Color { get; set; }
And in WPF, we can use Brush
to control Background, Foreground and so on.Usually we use SolidBrush: 在WPF中,我们可以使用
Brush
来控制Background,Foreground等,通常我们使用SolidBrush:
public System.Windows.Media.SolidColorBrush Brush { get; set; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.