WPF模拟雷达界面效果图

iPad塔防的防守兵的效果很炫,2个小时用WPF模拟了一个。

效果图:

WPF模拟雷达界面效果图

关键代码:

    <Grid>

        <Grid.Background>

            <ImageBrush ImageSource="Koala.jpg"/>

        </Grid.Background>



        <Button Content="Button1" HorizontalAlignment="Left" Margin="187,107,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/>



        <Grid x:Name="m_Grid" HorizontalAlignment="Left" VerticalAlignment="Top" Height="300" Width="300" MouseUp="m_Grid_MouseUp" Margin="69,31,0,0">

            <Ellipse Stroke="White" StrokeThickness="1">

                <Ellipse.Fill>

                    <RadialGradientBrush Opacity="1" RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.5,0.5">

                        <GradientStop Color="White" Offset="1.1" ></GradientStop>

                        <GradientStop Color="Transparent" Offset="0.92"></GradientStop>

                    </RadialGradientBrush>

                </Ellipse.Fill>

            </Ellipse>

            <Ellipse x:Name="m_Ellipse" Stroke="White" Margin="4">

                <Ellipse.Fill>

                    <RadialGradientBrush Opacity="1" RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.5,0.5">

                        <GradientStop Color="White" Offset="0.97" ></GradientStop>

                        <GradientStop Color="Transparent" Offset="0.96"></GradientStop>

                    </RadialGradientBrush>

                </Ellipse.Fill>

                <Ellipse.Clip>

                    <RectangleGeometry Rect="0,0,100,100" />

                </Ellipse.Clip>

                <Ellipse.RenderTransform>

                    <RotateTransform Angle="0" CenterX="146" CenterY="146"  /> 

                </Ellipse.RenderTransform>

                <Ellipse.Triggers>

                    <EventTrigger RoutedEvent="Window.Loaded">

                        <BeginStoryboard>

                            <Storyboard RepeatBehavior="Forever">

                                <DoubleAnimation Storyboard.TargetName="m_Ellipse"

                                                 Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"

                                                 To="180" 

                                                 Duration="0:0:5"/>

                            </Storyboard>

                        </BeginStoryboard>

                    </EventTrigger>

                </Ellipse.Triggers>

            </Ellipse>

            <Ellipse x:Name="m_Ellipse2" Stroke="White" Margin="4">

                <Ellipse.Fill>

                    <RadialGradientBrush Opacity="1" RadiusX="0.5" RadiusY="0.5" GradientOrigin="0.5,0.5">

                        <GradientStop Color="White" Offset="0.97" ></GradientStop>

                        <GradientStop Color="Transparent" Offset="0.96"></GradientStop>

                    </RadialGradientBrush>

                </Ellipse.Fill>

                <Ellipse.Clip>

                    <RectangleGeometry Rect="0,0,100,100" />

                </Ellipse.Clip>

                <Ellipse.RenderTransform>

                    <RotateTransform Angle="180" CenterX="146" CenterY="146"  />

                </Ellipse.RenderTransform>

                <Ellipse.Triggers>

                    <EventTrigger RoutedEvent="Window.Loaded">

                        <BeginStoryboard>

                            <Storyboard RepeatBehavior="Forever">

                                <DoubleAnimation Storyboard.TargetName="m_Ellipse2"

                                                 Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)"

                                                 To="360" 

                                                 Duration="0:0:5"/>

                            </Storyboard>

                        </BeginStoryboard>

                    </EventTrigger>

                </Ellipse.Triggers>

            </Ellipse>



            <Button Content="PopButton" HorizontalAlignment="Left" Margin="18,126,0,0" VerticalAlignment="Top" Width="75"/>

        </Grid>

        

    </Grid>

 

 

 

你可能感兴趣的:(WPF)