WPF BitmapSource ImageSource

前端 未结 3 1860
有刺的猬
有刺的猬 2021-01-12 14:24

I am binding an Image.Source property to the result of the property shown below.

public BitmapSource MyImageSource
{
    get
    {
        BitmapSource sour         


        
3条回答
  •  执笔经年
    2021-01-12 14:49

    Are you positive it's a PNG and not just a renamed Bitmap or Jpeg? If you create a new Bitmap image and then just rename it and change the file extension, this error is reproducible.

    If I use a known PNG with your code, I don't get your issue, but a COM exception is thrown:

    The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))

    Can you try it out with a random PNG off the web and see if you get the same result?

提交回复
热议问题