using System;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
namespace Video_Test {
/// <summary>
/// Description of MainForm.
/// </summary>
public class MainForm : System.Windows.Forms.Form {
private System.Windows.Forms.Panel panel1;
Video video = null;
public MainForm() {
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
OpenFileDialog ofdVideoLocation = new OpenFileDialog();
ofdVideoLocation.Filter = "Video Dateien (*.avi)|*.avi|Alle Dateien (*.*)|*.*";
ofdVideoLocation.Title = "Video laden";
if ( ofdVideoLocation.ShowDialog() == DialogResult.OK ){
try{
video = new Video( ofdVideoLocation.FileName, false );
video.CurrentPosition = 1;
video.Owner = panel1;
video.Play();
}catch ( Exception ex ){
MessageBox.Show( ex.ToString(),"Fehler!", MessageBoxButtons.OK, MessageBoxIcon.Error );
}
}
}
[STAThread]
public static void Main(string[] args) {
Application.Run(new MainForm());
}
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent() {
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// panel1
//
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(304, 228);
this.panel1.TabIndex = 1;
this.panel1.MouseDown += new MouseEventHandler(panel1_MouseDown);
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(304, 228);
this.Controls.Add(this.panel1);
this.Name = "MainForm";
this.Text = "MainForm";
this.ResumeLayout(false);
}
#endregion
private void panel1_MouseDown(object sender, MouseEventArgs e) {
if ( e.Button == MouseButtons.Left )
MessageBox.Show("!");
}
}
}