silverlight   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了SilverLight-非托管代码初始化进度条显示方法大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">         <param  NAME="SplashScreensource" value="SplashScreen.xaml"/>         <param nam
@H_502_0@
@H_502_0@ <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
        <param  NAME="SplashScreensource" value="SplashScreen.xaml"/>
        <param name="OnsourceDownloadProgressChanged" value="OnsourceDownloadProgressChanged" />

<param name="source" value="ClientBin/SilverLightAppTest.xap"/>
      <param name="onError" value="onSilverlightError" />
      <param name="BACkground" value="white" />
     <param name="minRuntimeVersion" value="4.0.50826.0" />
     <param name="autoUpgrade" value="true" />
    <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
   <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="获取 Microsoft Silverlight" style="border-style:none"/>
    </a>

</object>

在SilverLight加载时Object标签中新加入两个参数:

1.SplashScreensource属性用于标记初始屏幕xaml页

2.onsourceDownloadProgressChanged属性用于加载进度变化时的事件处理程序

程序如下:

SplashScreensource.xaml:

<Grid x:Name="LayoutRoot" BACkground="White">
        <StackPanel HorizontalAlignment="Center">
            <Grid HorizontalAlignment="Center">
                <Rectangle stroke="#FFDEE6F0" HorizontalAlignment="Left" Width="300" 
Height="10" RadiusX="2" RadiusY="2" strokeThickness="1"/>
                <Rectangle Fill="#FF7E99C8" HorizontalAlignment="Left" VerticalAlignment="Center" 
strokeThickness="0" RadiusX="0" RadiusY="0" Width="296" Height="6" x:Name="progressBar" 
RenderTransformOrigin="0,0.5" Margin="4">
                    <Rectangle.RenderTransform>
                        <ScaleTransform x:Name="progressBarScale" />
                    </Rectangle.RenderTransform>
                </Rectangle>
            </Grid>
            <Grid HorizontalAlignment="Center">
                <TextBlock x:Name="progressText" Margin="18,17,19" Height="26" Text="0%" 
FontSize="16" Opacity="0.8" VerticalAlignment="Bottom" TextAlignment="Right"/>
                <TextBlock x:Name="progressText2" Margin="18,7,8" Height="70" Text="0%" 
FontSize="50" Opacity="0.04" FontWeight="Bold" VerticalAlignment="Bottom" TextAlignment="Right"/>
            </Grid>
        </StackPanel>
    </Grid>

OnsourceDownloadProgressChanged

function OnsourceDownloadProgressChanged(sender,args) {
            sender.findName("progressText").Text = Math.round(eventArgs.progress * 100) + "%";
            sender.findName("progressText2").Text = Math.round(eventArgs.progress * 100) + "%";
            sender.findName("progressBarScale").ScaleX = eventArgs.progress;
        }

这样就自定义一个非托管代码的初始化进度条显示.

大佬总结

以上是大佬教程为你收集整理的SilverLight-非托管代码初始化进度条显示方法全部内容,希望文章能够帮你解决SilverLight-非托管代码初始化进度条显示方法所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。