XNA.Texture2D to System.Drawing.Bitmap

僤鯓⒐⒋嵵緔 提交于 2019-12-12 03:48:35

问题


I need load XNA.Texture2D to PictureBox.

i've tried this: http://www.gamedev.net/community/forums/viewreply.asp?ID=3224621 but it doesn't work. Any suggestions?


回答1:


You should be able to use that method, but make sure that your XNA Texture2D is created with a format of 32bbpARGB. Any other format will prevent that method from working directly.




回答2:


Easier way to do it is save the Texture2D using Texture2D.SaveAsPng or Texture2D.SaveAsJpeg to a memory stream and the open the virtual file using Bitmap(Stream).



来源:https://stackoverflow.com/questions/2768840/xna-texture2d-to-system-drawing-bitmap

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