相关疑难解决方法(0)

什么时候应该在WPF 4.0中使用SnapsToDevicePixels?

任何人都可以建议何时SnapsToDevicePixels在WPF 4.0中使用?

它是否应该仅在有问题的情况下偶尔使用,在整个应用程序中,只在某些控件或什么?

.net wpf snapstodevicepixels

56
推荐指数
3
解决办法
3万
查看次数

WPF 动画 GIF 使用太多内存来显示大 GIF 图像

我想通过使用库WPF Animated GIF来显示GIF。但是PictureSource设置属性后,进程内存从208MB上升到1GB。为什么?

在此处输入图片说明

XAML

<Image Name="content" MaxHeight="240" MaxWidth="340" 
       RenderOptions.BitmapScalingMode="LowQuality"
       Width="340" Height="240"
       MinWidth="340" MinHeight="240"
       gif:ImageBehavior.AutoStart="True"
       gif:ImageBehavior.AnimatedSource="{Binding Path=PictureSource}">
        <Image.Stretch>
            <MultiBinding Converter="{StaticResource ImageStretchConverter}">
                <Binding Path="PictureSource" />
                <Binding ElementName="content" Path="Source.Width" />
                <Binding ElementName="content" Path="Source.Height" />
            </MultiBinding>
        </Image.Stretch>
        <Image.BitmapEffect>
            <BlurBitmapEffect Radius="0" />
        </Image.BitmapEffect>
    <Image.CacheMode>
        <BitmapCache EnableClearType="True" 
                RenderAtScale="0.2" 
                SnapsToDevicePixels="True"/>
    </Image.CacheMode>
    <!--<Image.Source>
        <BitmapImage StreamSource="{Binding Path=PictureSource}" UriSource="{Binding Path=PictureSource}"
            DecodePixelWidth="340" DecodePixelHeight="240"/>
    </Image.Source>-->
</Image>
Run Code Online (Sandbox Code Playgroud)

图像拉伸转换器

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) {
    string path = values[0] …
Run Code Online (Sandbox Code Playgroud)

wpf xaml animated-gif

3
推荐指数
1
解决办法
1726
查看次数

标签 统计

wpf ×2

.net ×1

animated-gif ×1

snapstodevicepixels ×1

xaml ×1