【发布时间】:2016-12-05 17:19:40
【问题描述】:
我要在按钮上设置 png 图像:
Button btn = new Button();
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri(@"C:\temp\dog.png", UriKind.Relative));
btn.Background = brush;
我想把它倒过来(意思是负像)。
类似:
btn.Background = Invert(brush);
谢谢
【问题讨论】:
-
请注意,带有绝对 URI 的 UriKind.Relative 看起来很可疑。
-
@AliBahrainezhad 用于 winform,我正在使用 wpf