如果想给按钮背景设置为一张图片:
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,
原创文章,作者:254126420,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/277705.html