WPF button按钮背景颜色代码修改的办法


WPF 修改button按钮颜色的方式  跟C#略有区别,一下总价几种方式;20170802 姜彦
 
1.颜色简称
Button.Background = System.Windows.Media.Brushes.ForestGreen;

 

2.颜色代码
 
A:
           
 BrushConverter conv = new BrushConverter();
            Brush bru = conv.ConvertFromInvariantString("#FF255687") as Brush;
            btnSave.Background = (System.Windows.Media.Brush)bru;
 

 

B:
SolidColorBrush myBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0xFF, 0x25, 0x56, 0x87));
btnSave.Background = (System.Windows.Media.Brush)myBrush;

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM