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;

  • 相关阅读:
    快速排序
    冒泡排序
    mysql 拷贝表插入新的表
    http协议
    nginx错误日志error_log日志级别
    MySQL数据库远程访问的权限
    mysql create database 指定utf-8编码
    MYSQL日志
    linux常用命令
    java学习--基础知识进阶第六天--集合&迭代器、增强for & 泛型、常见数据结构、List子体系
  • 原文地址:https://www.cnblogs.com/candyzhmm/p/12713717.html
Copyright © 2011-2022 走看看