資源簡介
C#使用DriectX實現(xiàn)媒體播放并實現(xiàn)對視頻的截圖和顯示保存。

代碼片段和文件信息
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?Microsoft.DirectX.AudioVideoPlayback?;
namespace?使用DriectX實現(xiàn)媒體播放
{
????public?partial?class?Form1?:?Form
????{
????????private?Video?MyVideo?=?null;?
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????openFileDialog1.InitialDirectory?=?Application.StartupPath;
????????????if?(openFileDialog1.ShowDialog()?==?DialogResult.OK)
????????????{
????????????????//?記錄panel組件的大小
????????????????int?height?=?pictureBox1.Height;
????????????????int?width?=?pictureBox1.Width;
????????????????//?如果存在打開的Video文件,釋放它
????????????????if?(MyVideo?!=?null)
????????????????{
????????????????????MyVideo.Dispose();
????????????????}
????????????????//?打開一個新的Video文件
????????????????MyVideo?=?new?Video(openFileDialog1.FileName);
????????????????//?把Video文件分配給創(chuàng)建的Panel組件
????????????????MyVideo.Owner?=?pictureBox1;
????????????????//?以記錄的panel組件的大小來重新定義
????????????????pictureBox1.Width?=?width;
????????????????pictureBox1.Height?=?height;
????????????????//?播放AVI文件的第一幀,主要是為了在panel中顯示
????????????????MyVideo.Play();
????????????????MyVideo.Pause();
????????????}
????????????//確定窗體中的各按鈕狀態(tài)
????????????if?(MyVideo?==?null)
????????????{
????????????????button2.Enabled?=?false;
????????????????button3.Enabled?=?false;
????????????????button4.Enabled?=?false;
????????????}
????????????else
????????????{
????????????????button2.Enabled?=?true;
????????????????button3.Enabled?=?true;
????????????????button4.Enabled?=?true;
????????????}
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????if?(MyVideo?!=?null)
????????????{
????????????????MyVideo.Play();
????????????}
????????}
????????private?void?button3_Click(object?sender?EventArgs?e)
????????{
????????????if?(MyVideo?!=?null)
????????????{
????????????????MyVideo.Pause();
????????????}
????????}
????????private?void?button4_Click(object?sender?EventArgs?e)
????????{
????????????if?(MyVideo?!=?null)
????????????{
????????????????MyVideo.Stop();
????????????}
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????if?(MyVideo?==?null)
????????????{
????????????????button2.Enabled?=?false;
????????????????button3.Enabled?=?false;
????????????????button4.Enabled?=?false;
????????????}
????????????else
????????????{
????????????????button2.Enabled?=?true;
????????????????button3.Enabled?=?true;
????????????????button4.Enabled?=?true;
????????????}
????????}
????????private?void?button5_Click(object?sender?EventArgs?e)
????????{
????????????Bitmap?bit?=?new?Bitmap(pictureBox1.Width?pictureBox1.Height);
????????????Graphics?g?=?Graphics.FromImage
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????165??2014-04-01?17:57??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\app.config
?????文件??????11264??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\bin\Debug\使用DriectX實現(xiàn)媒體播放.exe
?????文件????????165??2014-04-01?17:57??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\bin\Debug\使用DriectX實現(xiàn)媒體播放.exe.config
?????文件??????28160??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\bin\Debug\使用DriectX實現(xiàn)媒體播放.pdb
?????文件??????11600??2014-04-02?15:27??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\bin\Debug\使用DriectX實現(xiàn)媒體播放.vshost.exe
?????文件????????165??2014-04-01?17:57??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\bin\Debug\使用DriectX實現(xiàn)媒體播放.vshost.exe.config
?????文件????????490??2010-03-17?22:39??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\bin\Debug\使用DriectX實現(xiàn)媒體播放.vshost.exe.manifest
?????文件???????3704??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Form1.cs
?????文件???????6579??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Form1.Designer.cs
?????文件???????6020??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Form1.resx
?????文件???????5420??2014-04-01?11:16??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6540??2014-04-02?15:27??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????4608??2014-04-01?17:53??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件???????2034??2014-04-02?15:27??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\使用DriectX實現(xiàn)媒體播放.csproj.FileListAbsolute.txt
?????文件????????975??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\使用DriectX實現(xiàn)媒體播放.csproj.GenerateResource.Cache
?????文件??????39163??2014-04-01?17:53??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\使用DriectX實現(xiàn)媒體播放.csprojResolveAssemblyReference.cache
?????文件??????11264??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\使用DriectX實現(xiàn)媒體播放.exe
?????文件????????180??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\使用DriectX實現(xiàn)媒體播放.Form1.resources
?????文件??????28160??2014-04-02?15:24??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\使用DriectX實現(xiàn)媒體播放.pdb
?????文件????????180??2014-04-01?17:53??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\使用DriectX實現(xiàn)媒體播放.Properties.Resources.resources
?????文件????????512??2014-04-01?09:44??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Program.cs
?????文件???????1412??2014-04-01?09:44??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Properties\AssemblyInfo.cs
?????文件???????2902??2014-04-01?17:53??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Properties\Resources.Designer.cs
?????文件???????5612??2014-04-01?09:44??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Properties\Resources.resx
?????文件???????1131??2014-04-01?17:53??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Properties\Settings.Designer.cs
?????文件????????249??2014-04-01?09:44??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\Properties\Settings.settings
?????文件???????4130??2014-04-01?17:53??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放.csproj
?????文件????????935??2014-04-01?09:44??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放.sln
????..A..H.?????37888??2014-04-02?15:27??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放.suo
?????目錄??????????0??2014-04-02?15:27??使用DriectX實現(xiàn)媒體播放\使用DriectX實現(xiàn)媒體播放\obj\x86\Debug\TempPE
............此處省略11個文件信息
- 上一篇:C#+ENVI/IDL開發(fā)
- 下一篇:C# 保存和讀取xm
l配置文件
評論
共有 條評論