开发者

WPF - ImageBrush with PNG, not respecting alpha-channel

开发者 https://www.devze.com 2022-12-08 02:21 出处:网络
I want to use an ImageBrush to use in the Rectangle.Fill.The file is a .PNG. It comes out looking like it is sitting on a little gray pad.The ImageBrushis returned from a converter with something like

I want to use an ImageBrush to use in the Rectangle.Fill. The file is a .PNG. It comes out looking like it is sitting on a little gray pad. The ImageBrush is returned from a converter with something like this:

        BitmapImage image = new BitmapImage(new Uri(fileName));
        ImageBrush imageBrush = new ImageBrush();
        imageB开发者_JAVA百科rush.ImageSource = image;


I was using this in a UserControl and it is either the UserControl or the Grid (that the rectangle sits in that is not transparent. The image\imagebrush is fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消