其他分享
首页 > 其他分享> > 【WPF】Button按钮动态设置Background背景颜色

【WPF】Button按钮动态设置Background背景颜色

作者:互联网

如果想给按钮背景设置为一张图片:

Button btn = new Button();
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri("Images/test.png", UriKind.Relative));
btn.Background = brush;
Background = System.Windows.Media.Brushes.White,

  

标签:ImageBrush,Button,brush,Background,new,WPF,btn
来源: https://www.cnblogs.com/guangzhiruijie/p/16531851.html