.NET Framework 4 in WPF not showing bitmap effect

前端 未结 5 1255
伪装坚强ぢ
伪装坚强ぢ 2021-01-13 07:06

I am having a problem using VS2010 and framework version 4 with bitmap effects. If I have the code below and run it in a WPF application using the .NET Framework 4 Client Pr

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-13 07:34

    As stated by others already: .NET 4.0 no longer supports BitmapEffects.

    As an additional info: Since there is no OuterGlowEffect which you can use with the Effect property (at least none that I am aware of), you can replace the bitmap effect with a DropShadowEffect and set its ShadowDepth property to 0. Then you can create a glow effect by adjusting the BlurRadius property. Furthermore, you can also adjust the Color property if you want the glow to have another color than black, but as I see from your code sample, you actually use black as the GlowColor.

    I know this workaround might not be as flexible and comfortable as the OuterGlowBitmapEffect and it does not produce identical results, but at least it comes close in some situations, and it is definitely easier than writing a pixel shader yourself...

提交回复
热议问题