如何通过单击按钮在wpf中播放mp4但不应该直接播放 [英] how to play mp4 in wpf by clicking button but it should not get played directly

查看:254
本文介绍了如何通过单击按钮在wpf中播放mp4但不应该直接播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在dot net(W PF)中创建了桌面应用程序。通过点击按钮我们播放mp 4. mp 4文件将存储在d盘中。



点击按钮时应该在应用程序中播放,但在双驱动器上双击时不应播放。



i不怎么做这个我复习请指导我做。



提前致谢....

I have created desktop application in dot net (W PF). In that by clicking button we play mp 4. that mp 4 file will be stored in d drive.

This mp 4 should play in application when button is clicked but it should not get played when it is double clicked on d drive.

i don't how to do this i am refresher please guide me to do.

Thanks in advance....

推荐答案

void BrowseClick(Object sender, EventArgs e)

       {

          OpenFileDialog openDlg =new OpenFileDialog();

           openDlg.InitialDirectory = @"c:\";

           openDlg.ShowDialog();

           MediaPathTextBox.Text = openDlg.FileName;

       }



      void PlayClick(object sender, EventArgs e)

       {

          if (MediaPathTextBox.Text.Length <= 0)

           {

               System.Windows.Forms.MessageBox.Show("Enter a valid media file");

              return;

           }

           VideoControl.Source = newUri(MediaPathTextBox.Text);

           VideoControl.Play();

       }

      void PauseClick(object sender, EventArgs e)

       {

           VideoControl.Pause();

       }

      void StopClick(object sender, EventArgs e)

       {

           VideoControl.Stop();

       }


这篇关于如何通过单击按钮在wpf中播放mp4但不应该直接播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆