How to load .dds files into a picturebox?

99封情书 提交于 2019-12-01 06:43:41

I think the short answer is that you don't. The documentation says that the supported formats are BMP, GIF, EXIG, JPG, PNG and TIFF.

Update: there seem to be a number of converters to be found through Google, that might help you out. Also, as Wayne suggests, look at XNA (if you didn't already). The Texture2D.FromFile method seems to handle the .dds files, but I never used it myself so I can't say if it is what you are looking for or not...

I had the same issue. Here is a good solution.

  1. Source: http://www.mastropaolo.com/devildotnet/
  2. Download Version 1.3 from that link (bottom of page)
  3. Add the Devil.NET.dll as a reference to your application
  4. Use the code that I have supplied below.

    PictureBox1.Image = DevIL.DevIL.LoadBitmap(DDS_File_Path)

It's really that easy. We owe the DevIL .NET Wrapper creator a beer.

You might want to take a look at the Microsoft's XNA Game Studio SDK to load the textures in memory and possibly capture the images in a System.Drawing.Graphics usable way.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!