C # plays music, invokes programs

Source: Internet
Author: User

One: C # plays music

string " /sound/msg.wav " // Application.startuppath: The program EXE location, you can also directly write a path to music New  ////player. Playlooping (); // play the player. Play ();

Two: C # call EXE

Logout of a program as an example: Click to log out after the program opened, and then close the program

if (process==null)  {     string path = Application.startuppath; // This path is the absolute path to the EXE program you are calling.     New System.Diagnostics.Process (); // Create a new process     Process. Startinfo.filename = assembly.getexecutingassembly (). Manifestmodule.fullyqualifiedname; // gets the file name of its own EXE or DLL     Process. Startinfo.workingdirectory = path;     Process. Start ();  }      this. Close ();

Three: Program Display clock

Write code in a time control that is set to 1000ms

   Private void Statetime_tick (object  sender, EventArgs e)        {            // Show status bar            " Soul-Heart Home improvement      budget software " + DateTime.Now.ToString ("yyyy mm month DD Day HH:mm:ss");        }

Four: Set the transparency of the custom control

         PublicUserControl1 () {InitializeComponent (); //set style to support transparent background color             This. SetStyle (Controlstyles.supportstransparentbackcolor,true);  This. BackColor = Color.FromArgb ( -, $, $, $); }        protected Override voidOnPaint (PaintEventArgs e) {Base.            OnPaint (e); E.graphics.drawstring ("",NewFont ("Tahoma",8.25f), Brushes.Red,NewPointF ( -, -)); }

C # plays music, invokes programs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.