开发者

C# cast audio form resources

i need some help regarding the following:

HomeArrayPicBox[i, j].Image = (Image)Properties.Resou开发者_如何学运维rces.ResourceManager.GetObject("Scan" + i);

SoundPlayer fire = new SoundPlayer(Properties.Resources.fire);

for the picbox i can load an image from resources using cast (Image).

i was wondering how to do this for audio i.e. some sort of (Audio)?

is this possible?


Yes, it's possible. Just use streams:

System.IO.Stream stream = Properties.Resources.ResourceManager.GetStream("resource_name");
System.Media.SoundPlayer player = new System.Media.SoundPlayer(stream);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜