Setting the filter to an OpenFileDialog to allow the typical image formats?

前端 未结 11 953
陌清茗
陌清茗 2020-12-22 16:07

I have this code, how can I allow it to accept all typical image formats? PNG, JPEG, JPG, GIF?

Here\'s what I have so far:

public void EncryptFile()
         


        
11条回答
  •  生来不讨喜
    2020-12-22 16:27

    For images, you could get the available codecs from GDI (System.Drawing) and build your list from that with a little work. This would be the most flexible way to go.

    ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
    

提交回复
热议问题