开发者

C# cast audio form resources

开发者 https://www.devze.com 2022-12-22 14:47 出处:网络
i need some help regarding the following: HomeArrayPicBox[i, j].Image = (Image)Properties.Resou开发者_如何学运维rces.ResourceManager.GetObject(\"Scan\" + i);

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

精彩评论

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

关注公众号