Silverlight学习笔记2 纹理模糊

  直接进入主题:

        BlurEffect   使目标纹理模糊的位图效果

  首先我们得using 一下:   using System.Windows.Media.Effects;

  给button一个Click事件  方法如下

代码
private void OnClickBlurButton(object sender, RoutedEventArgs args)
{
    
// Toggle effect
    if (((Button)sender).Effect != null)
    {
        ((Button)sender).Effect 
= null;
    }
    
else
    {
        
// Get a reference to the Button.
        Button myButton = (Button)sender;
      
        
// Initialize a new BlurEffect that will be applied
        
// to the Button.
        BlurEffect myBlurEffect = new BlurEffect();

        
// Set the Radius property of the blur. This determines how 
        
// blurry the effect will be. The larger the radius, the more
        
// blurring. 
        myBlurEffect.Radius = 10;
        
         ss.Effect
=myBlurEffect;//说明 ss我放入的一个图片name

        
// Apply the effect to the Button.
        myButton.Effect = myBlurEffect;
    }
}

 显示效果

算了 网速太卡。。。不上传效果了 。。。自己学习中

原文地址:https://www.cnblogs.com/blueSkys/p/1703166.html