using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
//API函数声明
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
PictureBox PlayScreen = pictureBox1;
string mciCommand;
//打开指定位置的视频文件
mciCommand = "open " + " D:\\picture\\2.wmv " + " alias MyAVI ";
mciCommand = mciCommand + " parent " + PlayScreen.Handle.ToInt32() + " style child ";
LibWrap.mciSendString(mciCommand, null, 0, 0);
Rectangle r = PlayScreen
用C#的PictureBox播放本地视频
最新推荐文章于 2024-05-31 20:51:15 发布
本文介绍如何使用C#的PictureBox控件播放本地视频。通过声明API函数并利用winmm.dll库,实现了在窗体中打开并显示视频文件的功能。当点击按钮时,视频将按照PictureBox的大小进行播放。同时,还提供了截图功能,能够保存当前视频画面为JPEG图片。
摘要由CSDN通过智能技术生成