【问题标题】:WPF: CroppedBitmap as Source in XAML displays nothingWPF:CroppedBitmap 作为 XAML 中的源不显示任何内容
【发布时间】:2013-01-06 10:17:26
【问题描述】:

不确定问题出在哪里。如果我执行以下操作:

<Image Width="90" Height="97" Source="<some path>" />

我的图像按预期显示。但我想裁剪它,所以我使用下面的代码和完全相同的路径。

<Image>
    <Image.Source>
        <CroppedBitmap Source="<same path>">
            <CroppedBitmap.SourceRect>
                <Int32Rect X="0" Y="0" Width="100" Height="100" />
            </CroppedBitmap.SourceRect>
        </CroppedBitmap>
    </Image.Source>
</Image>

什么也没有出现。谁能告诉我为什么它不起作用?如果有区别,我会使用 PNG。

【问题讨论】:

    标签: wpf xaml bitmap


    【解决方案1】:

    我有一个类似的问题,有一个 gif。在 Visual Studio 2012 中,图像不会显示在设计视图中,但当我实际运行应用程序时,裁剪后的图像显示得很好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-29
      • 2020-11-10
      • 2012-04-12
      • 2019-11-11
      相关资源
      最近更新 更多