奇怪的C#GUI +问题:在120 dpi下绘制时图像重新调整大小

时间:2016-03-24 23:06:39

标签: c# gdi+

在将dpi设置为120时,我在C#中遇到了一个奇怪的图像绘制问题。当我们生成此代码时,我们在运行时创建的图像在另一个Image对象中重新调整大小:

        if ((dstimg == null) || srcimg == null)) return;
        Graphics dstg = Graphics.FromImage(dstimg);
        dstg.PageUnit = GraphicsUnit.Pixel;
        dstg.SmoothingMode = SmoothingMode.None;// = dst.smooth;
        dstg.CompositingQuality = CompositingQuality.HighSpeed;
        dstg.InterpolationMode = InterpolationMode.NearestNeighbor;
        dstg.DrawImage(srcimg, x, y);
        dstg.Dispose();

srcimg是: enter image description here

而dstimg是: enter image description here

如果启用了Windows Aero功能,则无法显示此问题,因为Aero中的dpi始终为96px。但是一旦我们关闭Aero,问题就会出现。

我不知道出了什么问题。源图像对象和目标图像对象的DPI均为96 dpi。任何人都可以给我一些关于可能发生的事情的暗示吗?

0 个答案:

没有答案