媒体播放器 - 预加载多个剪辑

时间:2014-01-12 14:39:47

标签: c#

我正在尝试创建一个可以一次加载 MULTIPLE CLIPS 的媒体播放器。 加载吧。不玩了。

当你加载程序时,我希望用户可以点击“加载”并为每个按钮选择不同的文件。

剪辑全部加载后,用户可以浏览并单击与“加载”按钮对应的“播放”按钮。

我还希望在每个“播放”按钮旁边都有一个循环复选框(如果勾选,它会循环播放视频)

到目前为止的计划:

screenshot

当前来源:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MediaPlayer
{
public partial class Form1 : Form
{

    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    MediaPly _mp = null;
    private void button1_Click(object sender, EventArgs e)
    {
        if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
        {
            _mp = new MediaPly();
        }
    }

    private void button2_Click(object sender, EventArgs e)
    {
        _mp.LoadFile(openFileDialog1.FileName, this.panel1);
    }




    private void button3_Click(object sender, EventArgs e)
    {
        if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
        {
            _mp = new MediaPly();
        }
    }
    private void button4_Click(object sender, EventArgs e)
    {
        _mp.LoadFile(openFileDialog1.FileName, this.panel1);
    }




    private void button5_Click(object sender, EventArgs e)
    {
        if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
        {
            _mp = new MediaPly();
        }
    }

    private void button6_Click(object sender, EventArgs e)
    {
        _mp.LoadFile(openFileDialog1.FileName, this.panel1);
    }



}
}

1 个答案:

答案 0 :(得分:0)

您要将所有剪辑保存到同一个变量(_mp) 尝试将每个变量保存在不同的变量中:

MediaPly _mp = null;
private void button1_Click(object sender, EventArgs e)
{
    if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
    {
        _mp = new MediaPly();
    }
}

private void button2_Click(object sender, EventArgs e)
{
    _mp.LoadFile(openFileDialog1.FileName, this.panel1);
}



MediaPly _mp2 = null;
private void button3_Click(object sender, EventArgs e)
{
    if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
    {
        _mp2 = new MediaPly();
    }
}
private void button4_Click(object sender, EventArgs e)
{
    _mp2.LoadFile(openFileDialog1.FileName, this.panel1);
}



MediaPly _mp3 = null;
private void button5_Click(object sender, EventArgs e)
{
    if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
    {
        _mp3 = new MediaPly();
    }
}

private void button6_Click(object sender, EventArgs e)
{
    _mp3.LoadFile(openFileDialog1.FileName, this.panel1);
}