Sunday, 18 May 2014

How to add a (window media palyer) video clip to the form in window application


                                                                                                                                               Previous..
                                                                                                                                                   Next..

Here i will explain How to add a (window media palyer) video clip to the form in window application.

Step(1): Form
Drag and down 3 button and "window media palyer Tool" from toolBox. If i "(window media palyer tool" is not showing in your tool box then right click on your toolbox and choose item and click on "COM Component" and then  select "(window media palyer  " Then it will show you on your tool box and then drag and down this.
And give these button name as "Choose File" and "Start" , "Stop".




Step(2): Code
Now write code at every buttton.

At Choose button
private void Choose_Btn_click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog ();

if(openfile .ShowDialog() ==System.Window.Forms.DialogResult.OK)
{
textBox1.Text =  openfile .FileName;

}
}

At Start button
private void Start_Btn_click(object sender, EventArgs e)
{
axWindowMediaPlayer1.URL = textBox1.Text;

axWindowMediaPlayer1.Ctlcontrols.play();

}
At Stop button
private void Stop_Btn_click(object sender, EventArgs e)
{
axWindowMediaPlayer1.Ctlcontrols.Stop();
}

At Pause button (If you want pause button)
private void pause_Btn_click(object sender, EventArgs e)
{
axWindowMediaPlayer1.Ctlcontrols.Pause();
}

Step(3): Output
Now Run your application and choose a file and play this.
                                                                                                                                               Previous..
                                                                                                                                                   Next..

No comments:

Post a Comment

C# program Selection Sorting

Selection sort is a straightforward sorting algorithm. This algorithm search for the smallest number in the elements array and then swap i...