【问题标题】:WPF - ImageBrush with PNG, not respecting alpha-channelWPF - 带有PNG的ImageBrush,不尊重alpha通道
【发布时间】:2011-08-18 15:15:30
【问题描述】:

我想在Rectangle.Fill 中使用ImageBrush。该文件是 .PNG。它看起来就像坐在一个灰色的小垫子上。 ImageBrush 从转换器返回,如下所示:

        BitmapImage image = new BitmapImage(new Uri(fileName));
        ImageBrush imageBrush = new ImageBrush();
        imageBrush.ImageSource = image;

【问题讨论】:

    标签: wpf imagebrush


    【解决方案1】:

    我在 UserControl 中使用它,它是 UserControl 或 Grid(矩形所在的不是透明的。image\imagebrush 很好。

    【讨论】:

    • 位图是否支持透明度(您是否在位图上调用了 .MakeTransparent 或使用了带有 Alpha 通道的 ImageFormat,例如 PNG)?只是一个想法。
    猜你喜欢
    • 2016-07-26
    • 1970-01-01
    • 2018-06-26
    • 2010-10-30
    • 2011-03-07
    • 2016-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多