C#WPF将系统颜色设置为按钮 [英] C# WPF set system color to button
本文介绍了C#WPF将系统颜色设置为按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将按钮的背景色更改为系统颜色.就像我要更改按钮的颜色
I want to change the background color of button to system color. Just like I am changing the button color
button2.Background = Brushes.Blue;
变成蓝色.但是,不,我不想将颜色更改为系统颜色.
to blue. But no I want to Change the color to system color.
推荐答案
您可以从System.Windows.SystemColors中获取系统颜色
You can get system color from System.Windows.SystemColors
button2.Background = System.Windows.SystemColors.MenuHighlightBrush;
WPF背景类型为System.Windows.Media.Brush.您可以设置其他颜色,如下所示:
WPF Background is of type System.Windows.Media.Brush. You can set another color like this:
// using System.Windows.Media;
button2.Background = Brushes.White;
button2.Background = new SolidColorBrush(Color.White);
button2.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0, 0);
这篇关于C#WPF将系统颜色设置为按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文