zoukankan      html  css  js  c++  java
  • WPF 等待加载效果

    <UserControl x:Class="CustomControl.LoadingWait"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:local="clr-namespace:CustomControl"
                 mc:Ignorable="d" 
                 IsVisibleChanged="HandleVisibleChanged">
        <UserControl.Background>
            <SolidColorBrush Color="Transparent"/>
        </UserControl.Background>
        <UserControl.Resources>
            <SolidColorBrush Color="#329FEE" x:Key="CirclesColor" />
            <!--<SolidColorBrush Color="Black" x:Key="BackgroundColor" Opacity=".20" />-->
        </UserControl.Resources>
        <Viewbox Width="50" Height="50"  
                HorizontalAlignment="Center"  
                VerticalAlignment="Center">
            <Grid x:Name="LayoutRoot"   
                    Background="Transparent"  
                    ToolTip="Please wait...."  
                    HorizontalAlignment="Center"  
                    VerticalAlignment="Center">
                <TextBlock Text="Loading..."  HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="#FFE3953D" FontWeight="Bold" />
                <Canvas RenderTransformOrigin="0.5,0.5"  
                        HorizontalAlignment="Center"  
                        VerticalAlignment="Center" Width="120"  
                        Height="120" Loaded="HandleLoaded"  
                        Unloaded="HandleUnloaded"  >
                    <Ellipse x:Name="C0" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="1.0"/>
                    <Ellipse x:Name="C1" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.9"/>
                    <Ellipse x:Name="C2" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.8"/>
                    <Ellipse x:Name="C3" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.7"/>
                    <Ellipse x:Name="C4" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.6"/>
                    <Ellipse x:Name="C5" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.5"/>
                    <Ellipse x:Name="C6" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.4"/>
                    <Ellipse x:Name="C7" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.3"/>
                    <Ellipse x:Name="C8" Width="20" Height="20"  
                             Canvas.Left="0"  
                             Canvas.Top="0" Stretch="Fill"  
                             Fill="{StaticResource CirclesColor}" Opacity="0.2"/>
                    <Canvas.RenderTransform>
                        <RotateTransform x:Name="SpinnerRotate"  
                             Angle="0" />
                    </Canvas.RenderTransform>
                </Canvas>
            </Grid>
        </Viewbox>
    </UserControl>

    使用:

    <local:LoadingWait x:Name="_loading"  Visibility="Collapsed" Grid.Row="1" HorizontalAlignment="Center" Margin="0,-120,0,0"/>

    控制隐藏或显示

    this._loading.Visibility = Visibility.Visible;

    this._loading.Visibility = Visibility.Collapsed;

  • 相关阅读:
    里氏替换原则
    开闭原则
    Java Swing 介绍
    redis发布订阅模式
    Spring Cloud Bus消息总线+rabbitmq+Gradle(Greenwich.RELEASE版本)
    文档对象模型(DOM)系列三:处理元素属性
    文档对象模型(DOM)系列二:在DOM元素间移动
    文档对象模型(DOM)系列一:DOM基础
    深入理解javascript中的this 关键字(转载)
    javascript中的函数
  • 原文地址:https://www.cnblogs.com/candyzhmm/p/12713717.html
Copyright © 2011-2022 走看看