Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf DropShadowEffect和OuterGlowBitmapEffect动画占用了太多的CPU和内存?_Wpf - Fatal编程技术网

Wpf DropShadowEffect和OuterGlowBitmapEffect动画占用了太多的CPU和内存?

Wpf DropShadowEffect和OuterGlowBitmapEffect动画占用了太多的CPU和内存?,wpf,Wpf,设置DropShadoweffect和OuterGlowBitmapEffect的动画会不断增加内存和CPU使用率。为什么它占用了太多的内存和cpu使用,有没有办法减少或避免 <Window.Resources> <Storyboard x:Key="Storyboard1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName=

设置DropShadoweffect和OuterGlowBitmapEffect的动画会不断增加内存和CPU使用率。为什么它占用了太多的内存和cpu使用,有没有办法减少或避免

<Window.Resources>
    <Storyboard x:Key="Storyboard1">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
        Storyboard.TargetName="textBlock" 
        Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)"
    RepeatBehavior="Forever">
            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
            <SplineDoubleKeyFrame KeyTime="00:00:00.9000000" Value="25"/>
        </DoubleAnimationUsingKeyFrames>

    </Storyboard>
</Window.Resources>
<Window.Triggers>
    <EventTrigger RoutedEvent="FrameworkElement.Loaded">
        <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
    </EventTrigger>
</Window.Triggers>

<Grid x:Name="LayoutRoot">
    <TextBlock x:Name="textBlock" HorizontalAlignment="Left" VerticalAlignment="Top" Text="Drop Shadow Effect" TextWrapping="Wrap" Margin="189,126,0,0" FontWeight="Bold">
        <TextBlock.Effect>
            <DropShadowEffect ShadowDepth="5" BlurRadius="0"/>
        </TextBlock.Effect>
    </TextBlock>
</Grid>

没有OuterGlowEffect这样的类

你是说OuterGlowBitmapEffect吗?如果是这样的话,这是一个已知性能问题的弃用类,这可以解释您的问题。使用BlurEffect或其他DropShadowEffect来实现您想要的效果。(另外,请确保您没有使用不推荐的DropShadowBitmapEffect。)

但这也可能是你的代码的问题,在这种情况下,发布它