Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add a sound file to a resource and play it in ASP.NET

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "how to add sound files to resources and play them in ASP.NET". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The details are as follows:

1. The way to add resources is as follows:

2. Form2.cs is as follows:

/ Any source code blocks look like this//using System.Reflection;using System.IO;using System.Resources;using System.Media;using System.Diagnostics;namespace Yournamespace {public partial class Form2: Form {public Form2 () {InitializeComponent ();} private void Form2_Load (object sender, EventArgs e) {Assembly assembly; Stream soundStream; SoundPlayer sp; assembly = Assembly.GetExecutingAssembly (); sp = new SoundPlayer (assembly.GetManifestResourceStream ("Yournamespace.Dreamer.wav")); sp.Play () } / * SoundPlayer sp = new SoundPlayer (global::WindowsApplication1.Properties.Resources.yoursoundfilename); * / "how to add sound files to resources and play them in ASP.NET" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report