0
BitmapImage B = new BitmapImage();
B.BeginInit();
B.StreamSource = asm.GetManifestResourceStream("WpfApplication26.Back1.png");
B.EndInit();
image1.Source = B;

图片(Back1.png)的大小为32*32,我将图片控件的大小设置为32*32,并将属性“Scale”设置为“None”。

4

3 回答 3

1

尝试

RenderOptions.BitmapScalingMode="NearestNeighbor"

在 xaml 中的图像控件上或

RenderOptions.SetBitmapScalingMode(image1, BitmapScalingMode.NearestNeighbor)

在代码中。

于 2011-01-13T20:56:14.077 回答
0

试试SnapsToDevicePixels="True"图像控制。

于 2011-01-13T19:38:31.697 回答
0

如果您仍然想清除图像,意思是将其变为空白,只需将源设置为“null”

image1.Source = null;

这不需要 BitmapImage。

这么晚才回复很抱歉...

于 2011-10-25T10:22:43.983 回答