wince c#实现 视频播放控制
各位大侠,我想在WINCE平台上实现一个视频的播放界面,并且可以通过程序控制播放和暂停,请问有哪位有这方面的高见??
------解决方案--------------------首先你要添加axWindowsMediaPlayer控件,
你可以右击”工具箱“->添加项...找到COM组件里面的
Windows Media Player添加就OK了
private void tr_start_Click(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = @"f:\kugou\a.mp3";
axWindowsMediaPlayer1.Ctlcontrols.play();
}
int i = 1;
private void tr_pause_Click(object sender, EventArgs e)
{
if (i == 1)
{
axWindowsMediaPlayer1.Ctlcontrols.pause();
tr_pause.Text = "继续";
i = 0;
}
else
{
axWindowsMediaPlayer1.Ctlcontrols.play();
tr_pause.Text = "暂停";
i = 1;
}
}
private void tr_stop_Click(object sender, EventArgs e)
{
axWindowsMediaPlayer1.Ctlcontrols.stop();
}
------解决方案--------------------这个太简单啦 直接拉控件撒 在工具箱里面右击选项com主键找到 播放控件添加 就可以啦
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
DialogResult fd = ofd.ShowDialog();
if (fd == DialogResult.Cancel)
{
return;
}
else
{
listBox1.Items.Add(ofd.FileNames[0]);
DataSet ds = new DataSet();
}
}
private void Form1_Load(object sender, EventArgs e)
{
axWindowsMediaPlayer1.windowlessVideo = false;
axWindowsMediaPlayer1.Ctlcontrols.stop(); //停止
axWindowsMediaPlayer1.Ctlcontrols.pause(); //暂停
axWindowsMediaPlayer1.settings.autoStart = true; //自动播放
axWindowsMediaPlayer1.settings.mute = false; //静音