using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;namespace APImciTest
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
///
public class LibWrap
{
[DllImport(("winmm.dll"), EntryPoint="mciSendString", CharSet=CharSet.Auto )]
public static extern int mciSendString
( string lpszCommand, string lpszReturnString, uint cchReturn, int hwndCallback);
} //此处为API函数声明部分
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlText;
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(292, 273);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.DoubleClick += new System.EventHandler(this.pictureBox1_DoubleClick);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.pictureBox1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void pictureBox1_DoubleClick(object sender, System.EventArgs e) //此处为双击播放应用部分,mciCommand中注意空格
{
PictureBox PlayScreen = new PictureBox();
PlayScreen = this.pictureBox1;
string mciCommand;
mciCommand = "open " + "H:\\12.asf" + " alias MyAVI";
mciCommand = mciCommand + " parent " + PlayScreen.Handle.ToInt32() + " style child";
LibWrap.mciSendString(mciCommand, null, 0,0);
Rectangle r = PlayScreen.ClientRectangle;
mciCommand = "put MyAVI window at 0 0 "+r.Width +" "+r.Height ;
LibWrap.mciSendString( mciCommand, null, 0, 0);
LibWrap.mciSendString ("play MyAVI", null, 0, 0); }
}
}
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;namespace APImciTest
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
///
public class LibWrap
{
[DllImport(("winmm.dll"), EntryPoint="mciSendString", CharSet=CharSet.Auto )]
public static extern int mciSendString
( string lpszCommand, string lpszReturnString, uint cchReturn, int hwndCallback);
} //此处为API函数声明部分
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox pictureBox1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlText;
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(292, 273);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.DoubleClick += new System.EventHandler(this.pictureBox1_DoubleClick);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.pictureBox1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void pictureBox1_DoubleClick(object sender, System.EventArgs e) //此处为双击播放应用部分,mciCommand中注意空格
{
PictureBox PlayScreen = new PictureBox();
PlayScreen = this.pictureBox1;
string mciCommand;
mciCommand = "open " + "H:\\12.asf" + " alias MyAVI";
mciCommand = mciCommand + " parent " + PlayScreen.Handle.ToInt32() + " style child";
LibWrap.mciSendString(mciCommand, null, 0,0);
Rectangle r = PlayScreen.ClientRectangle;
mciCommand = "put MyAVI window at 0 0 "+r.Width +" "+r.Height ;
LibWrap.mciSendString( mciCommand, null, 0, 0);
LibWrap.mciSendString ("play MyAVI", null, 0, 0); }
}
}
解决方案 »
- 简单c#读取access数据库问题
- 身份验证的配置问题
- 请教WPF代码增加控件的问题
- 急!急!在线等!C# Windows Forms 中自定义TextBox控件的属性和方法。跪求!高人请进
- DataGridView 多余那个空行如何隐藏
- C#窗体上怎么显示动态图片?或者是flash?并且能能通过事件触发才显示出来!
- 请大家介绍一些较完善的表格控件或数据控件
- 再开一贴问,怎么将部分SQL语句传入存储过程并执行,急
- 怎样区分普通光驱与刻录机?急~~~在线等!!!
- sql server中保存大文件的问题(上100M或者几百M)求助!!!!
- Media Player 问题
- dataGrid打印问题。谢谢大家
不过,我结算的时候一定忘不了你,多谢raulredondo() !