• Silverlight 自定义加载页面


    xaml代码行:

    1.<Canvas   
    2.        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       
    3.        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
    4.        x:Name="parentCanvas"        
    5.         Width="1262" Height="613" Background="Black"  
    6.        >  
    7.    <Canvas.Triggers>  
    8.      <EventTrigger RoutedEvent="Canvas.Loaded">  
    9.        <BeginStoryboard>  
    10.  
    11.          <Storyboard x:Name="CycleAnimation" RepeatBehavior="Forever">  
    12.      <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="snake" Storyboard.TargetProperty="Angle">  
    13.        <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"></SplineDoubleKeyFrame>  
    14.        <SplineDoubleKeyFrame KeyTime="00:00:02" Value="10"></SplineDoubleKeyFrame>  
    15.        <SplineDoubleKeyFrame KeyTime="00:00:04" Value="0"></SplineDoubleKeyFrame>  
    16.        <SplineDoubleKeyFrame KeyTime="00:00:06" Value="-10"></SplineDoubleKeyFrame>  
    17.        <SplineDoubleKeyFrame KeyTime="00:00:08" Value="0"></SplineDoubleKeyFrame>  
    18.      </DoubleAnimationUsingKeyFrames>  
    19.    </Storyboard>  
    20.        </BeginStoryboard>  
    21.      </EventTrigger>  
    22.    </Canvas.Triggers>  
    23.  <Grid Width="1262" Height="613">  
    24.    <Grid Width="120" Height="98" VerticalAlignment="Center" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0" x:Name="pb1">  
    25.      <Grid.Background>  
    26.        <ImageBrush ImageSource="/loading/ss.png"></ImageBrush>  
    27.      </Grid.Background>  
    28.      <Grid.RenderTransform>  
    29.        <TransformGroup>  
    30.          <ScaleTransform/>  
    31.          <SkewTransform/>  
    32.          <RotateTransform Angle="0" x:Name="snake"/>  
    33.          <TranslateTransform/>  
    34.        </TransformGroup>  
    35.      </Grid.RenderTransform>  
    36.      <TextBlock x:Name="txtLoad" Text="0%" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Margin="0 30 0 0" Foreground="White"></TextBlock>  
    37.    </Grid>  
    38.  </Grid>  
    39.</Canvas>  
    

    js代码行:

    1.function onSourceDownloadProgressChanged(sender, eventArgs) {  
    2.    sender.findName("txtLoad").Text = "" + Math.round((eventArgs.progress * 1000)) / 10 + "%";  
    3.}  
    
     function onSourceDownloadProgressChanged(sender, eventArgs) {
         sender.findName("txtLoad").Text = "" + Math.round((eventArgs.progress * 1000)) / 10 + "%";
     }

    在aspx引用silverlight的object中加入

    <param name="splashscreensource" value="Loading/CustomLoadPage.xaml"/> <param name="onSourceDownloadProgressChanged" value="onSourceDownloadProgressChanged" />

    并引用上面的js文件

    js文件的主要作用是显示载入的百分比.

    silverlight的初始化屏幕.微软说明地址:http://msdn.microsoft.com/zh-cn/library/cc838130(VS.95).aspx

    关于循环动画的事件触发器:http://msdn.microsoft.com/zh-cn/library/bb979699(VS.95).aspx

    <EventTrigger RoutedEvent="Canvas.Loaded">的意思就是当这个画布被加载后.所执行的事件.

    这样就可以在这个中间写入我们需要显示的效果.不需要用js来调用storybroder的启动.

  • 相关阅读:
    156
    More Effective C++ 条款24 了解virtual function,multiple inheritance,virtual base classes,runtime type identification的成本
    More Effective C++ 条款23 考虑使用其他程序库
    More Effective C++ 条款22 考虑以操作符复合形式(op=)取代其独身形式(op)
    More Effective C++ 条款21 利用重载技术避免隐式类型转换
    More Effective C++ 条款20 协助完成"返回值优化(RVO)"
    More Effective C++ 条款19 了解临时对象的来源
    More Effective C++ 条款18 分期摊还预期的成本
    More Effective C++ 条款17 考虑使用lazy evaluation(缓式评估)
    More Effective C++ 条款16 谨记80-20法则
  • 原文地址:https://www.cnblogs.com/zhangxin1989/p/2733771.html
Copyright © 2020-2023  润新知