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

前端 未结 11 1034
陌清茗
陌清茗 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:35

    Follow this pattern if you browsing for image files:

    dialog.Filter =  "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";
    

提交回复
热议问题