Visual Studio 之 Background 改变颜色

来源:互联网 发布:mysql partition by 编辑:程序博客网 时间:2024/06/06 00:04


画了个slider控件,想通过Zigbee采集到的数据提示报警信息,slider控件的Value和Background颜色为可视化报警信息。因而需要在cs中修改Slider.Background的值。


尝试过:


<span style="font-size:14px;">1.   slider.Background = DeepPink;</span>

报错信息:当前上下文中不存在名称“DeepPink”


<span style="font-size:14px;">2.   slider.Background = #FFE61493</span>

报错信息:预处理器指令必须作为一行的第一个非空白字符出现


<span style="font-size:14px;">4.   slider.Background = FFE61493;</span>
报错信息:当前上下文中不存在名称“FFE61493”

<span style="font-size:14px;">4.   slider.Background = 1;</span>
报错信息:无法将类型“int”隐式转换为“System.Windows.Media.Brush”


都没用。


<span style="font-size:14px;">5.   slider.Background = Brushes.Red</span>

有用。



0 0