1

如何制作动画 .gif 以动画 WPF 用户控件中的每一帧?此处的 .gif 仅显示第一帧。

<UserControl.Triggers>
    <EventTrigger RoutedEvent="Button.Click" SourceName="btnPressQ">
        <EventTrigger.Actions>
            <BeginStoryboard Storyboard="{StaticResource sbdShowAlfa}"/>
        </EventTrigger.Actions>
    </EventTrigger>    
</UserControl.Triggers>

<Button Grid.Column="2" Command="{Binding Path=PressAndRelease}" CommandParameter="Q" Style="{StaticResource TransparentButton}">
                <Button.Template>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Image Name="imgNormalQ" Source="/Wosk;component/Images/Alphaberts/Q1.png" Height="127" />
                            <Image Name="imgPressedQ" Source="/Wosk;component/Images/Alphaberts/DancingPeaks.gif" Height="262" Width="119" Margin="-23,-136,-21,0" Visibility="Hidden"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Panel.ZIndex" Value="999"/>
                                <Setter TargetName="imgPressedQ" Property="Visibility" Value="Visible"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Button.Template>
            </Button>
4

1 回答 1

0

为什么不让动画 gif 驻留在帧之外呢?每一帧上的动画 .gif 都会对动画起作用,因为每一帧都必须在每一帧上重新开始。

于 2012-04-09T03:25:08.073 回答