Advertisement

WPF模拟探照灯显示文字

阅读量:

通过使用Blend工具,能够简便地实现WPF中类似探照灯照射文字的视觉效果。关于Blend的具体操作步骤在此不再详细说明,将代码复制出来后即可大致了解实现方式,该效果主要通过矩形、圆形以及透明度等元素组合完成。

以下为对应的XAML代码:

复制代码
 <Window  x:Class="WPF探照灯.MainWindow"

    
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
      Title="MainWindow" Height="200" Width="527" WindowStyle="None" Background="Black" WindowStartupLocation="CenterScreen">
    
     <Window.Resources>
    
     <Storyboard x:Key="SearchLight" RepeatBehavior="Forever" AutoReverse="True">
    
         <DoubleAnimationUsingKeyFrames 

全部评论 (0)

还没有任何评论哟~