none
对于SilverLight 动画中 控件同时设置Opacity和Effect属性时 CPU占用率总在95%以上 RRS feed

  • 问题

  • 对于SilverLight 动画中 控件同时设置Opacity和Effect属性时 CPU占用率总在95%以上
    做一个跑马灯效果
    <UserControl x:Class="SilverlightBlog.Controls.GoAroundControl"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Width="150"
        Background="Transparent"
        Foreground="Black">
        <Canvas x:Name="LayoutRoot" Background="Transparent" Opacity="0.5">
            <Canvas.Triggers>
                <EventTrigger RoutedEvent="Canvas.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard x:Name="goAround" RepeatBehavior="Forever" Storyboard.TargetProperty="(Canvas.Left)">
                                <DoubleAnimation Storyboard.TargetName="text1" To="-190" Duration="0:0:5" From="10"></DoubleAnimation>
                                <DoubleAnimation Storyboard.TargetName="text2" To="10" Duration="0:0:5" From="210"></DoubleAnimation>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Canvas.Triggers>
            <TextBlock x:Name="text1" Width="200" Canvas.Left="10" Text="请点击播放按扭收听音乐" >
            </TextBlock>
            <TextBlock x:Name="text2" Width="200" Canvas.Left="210" Text="请点击播放按扭收听音乐">
            </TextBlock>
            <Canvas.Effect>
                <DropShadowEffect BlurRadius="10" Color="White" ShadowDepth="0"></DropShadowEffect>
            </Canvas.Effect>
        </Canvas>
    </UserControl>
    去掉Opacity和Effect 任何一个都正常,一起使用CPU就在95%以上了
    2010年1月31日 13:57

答案

全部回复