我在WPF应用程序中遇到了这个错误。
无效的文件名。TitleContainer.OpenStream 需要相对 URI。
pic_texture = Texture2D.FromStream(GraphicsDevice, TitleContainer.OpenStream(@"\Images\performer.png"));
我也尝试过
@"/WpfControlLibrary1;component/Images/performer.png"
没有成功...
如果我这样做
pic_texture = Texture2D.FromStream(GraphicsDevice, TitleContainer.OpenStream(@"performer.png"));
并将文件放在根目录中
错误是:
加载“performer.png”时出错。找不到文件。
有什么线索吗?
谢谢!
P.S. 我确定文件没问题。
更新:
这篇文章https://gamedev.stackexchange.com/questions/9748/xna-am-i-screwing-up-the-loadcontent-for-texture2d也没有帮助。
FileInfo.OpenRead(..)
,但我不确定它是否适用于WP7或Xbox。 - neeKo