Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GifImage控件 Dispose 后设置 Visible 引发 GdiplusInvalidParameter 异常 #680

Closed
hitchao opened this issue Feb 18, 2021 · 2 comments
Closed
Labels
🐛 bug Something isn't working

Comments

@hitchao
Copy link

hitchao commented Feb 18, 2021

GifImage控件Dispose 后设置visible 引发 GdiplusInvalidParameter 异常

  • GifImage 在 dispose 并 Hidden 之后,再次设置 Visible 会导致 GdiplusInvalidParameter
  • 从左到右依次点击按钮

Environment

  • .net: 4.7.2
  • IDE vs2019
  • Version 3.0.0

XAML:

<StackPanel Margin="10"> 
    <hc:GifImage x:Name="GifImage" Width="500" Height="300" Margin="10"/>
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
        <Button Height="50" Width="100" HorizontalAlignment="Center" Content="Load" Click="Button_Click"/>
        <Button Height="50" Width="100" HorizontalAlignment="Center" Content="Dispose" Click="Button_Click_1"/>
        <Button Height="50" Width="100" HorizontalAlignment="Center" Content="Hidden" Click="Button_Click_2"/>
        <Button Height="50" Width="100" HorizontalAlignment="Center" Content="Visible" Click="Button_Click_3"/>
    </StackPanel>
</StackPanel>

CS:

string gifpath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test.gif");
private void Button_Click(object sender, RoutedEventArgs e)
{
    GifImage.Uri = new Uri($"pack://siteoforigin:,,,/{gifpath}");
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
    GifImage.Dispose();
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
    GifImage.Visibility = Visibility.Hidden;
}
private void Button_Click_3(object sender, RoutedEventArgs e)
{
    //GifImage.Uri = new Uri(GifImage.Uri.OriginalString);
    GifImage.Visibility = Visibility.Visible;
}
@NaBian NaBian closed this as completed in ebcb709 Mar 1, 2021
@ghost1372 ghost1372 added the 🐛 bug Something isn't working label Apr 1, 2021
@simadi
Copy link

simadi commented May 20, 2023

我也遇到了这个问题怎么解决?3.4版本

@Farb
Copy link

Farb commented Jul 12, 2023

我也遇到这个问题了 ,3.4版本。这样启动的时候直接报错了
<hc:GifImage x:Name="GifImageMain" Stretch="None" Margin="5" Uri="/2.gif" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants