zoukankan      html  css  js  c++  java
  • [顶] Silverlight实现发光效果

        插播一篇与NParsing框架无关的文章。是我实际项目中积累一点小小经验,给大家分享一下。


        可能用过WPF的人知道,在WPF中实现发光效果很简单,用BitmapEffect就可以实现。但是Silverlight中没有BitmapEffect,在网上找了好几天的资料

    也没找到决解办法。最终只能放弃了这种效果,让我不爽了好久。

        后然当我看到用BlurEffect对Rectangle做了模糊效果后,在脑袋里就有了这样一个想法。只要用两个Rectangle,下面那Rectangle

    用BlurEffect做模糊效果不就是我要的发光效果吗。

    代码如下:

    <UserControl
        
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x
    ="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:System
    ="clr-namespace:System;assembly=mscorlib"
        xmlns:d
    ="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable
    ="d" xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
        x:Class
    ="BTES_SilverlightApplication.MainPage"
        Width
    ="400" Height="300">
        
    <Grid x:Name="LayoutRoot" Background="White">
            
    <Rectangle Fill="Black" Stroke="Black" Margin="80">
                
    <Rectangle.Effect>
                    
    <BlurEffect Radius="15"/>
                
    </Rectangle.Effect>
            
    </Rectangle>
            
    <Rectangle Fill="Black" Stroke="Black" Margin="80"/>
        
    </Grid>
    </UserControl>

    效果图

  • 相关阅读:
    docker相关资源监控采集方法整理
    三节课MINI计划第四周
    三节课MINI计划第五周
    三节课MINI计划第四周
    三节课MINI计划第三周
    三节课MINI计划第二周
    Bilibili用户需求分析报告
    三节课MINI计划第一周
    《产品思维30讲 》学习笔记
    PHP-FPM未授权访问漏洞
  • 原文地址:https://www.cnblogs.com/zhidian/p/1722486.html
Copyright © 2011-2022 走看看