我有
我需要
XAML:
<Image Height="500"
MouseLeftButtonDown="image_MouseLeftButtonDown"
MouseRightButtonDown="image_MouseRightButtonDown"
Name="image"
Stretch="Fill"
Width="500" />`
C#:
wbmap = new WriteableBitmap(50, 50, 500, 500, PixelFormats.Indexed8, palette);
wbmap.WritePixels(new Int32Rect(0, 0, wbmap.PixelWidth, wbmap.PixelHeight), pixels, wbmap.PixelWidth * wbmap.Format.BitsPerPixel / 8, 0);
image.Source = wbmap;
答案 0 :(得分:25)
正如tkerwin所提到的,将XAML中的BitmapScalingMode更改为NearestNeighbor
图片代码:
RenderOptions.BitmapScalingMode="NearestNeighbor"
答案 1 :(得分:15)
也许您需要将位图缩放模式更改为最近邻居。
将RenderOptions.BitmapScalingMode="NearestNeighbor"
添加到您的图片代码中。
答案 2 :(得分:0)