WPF: How to display an image at its original size?

后端 未结 5 1036
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 13:05

I have a problem with displaying images in WPF.

Here\'s my code:

5条回答
  •  情书的邮戳
    2020-12-02 13:28

    Here is a similar question. Generally setting Stretch="None" is enough.

    It is also very important what DPI has the image set in metadata. It took me quite a while before figuring out that if the image's DPI is different from the monitor's DPI (usually 96), WPF will automatically resize the image, as it tries to be DPI-independent.


    EDIT

    The MSDN link is broken, here is the new link: MSDN Blog - Blurry Bitmaps. Let's keep the old link around to be used for archive.org, in case the new link stops working also.

提交回复
热议问题