All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
.Net下二进制形式的文件(图片)的存储与读取_[Asp.Net教程]
如何在SQL,Server中保存和输出图片_[SQL,Server教程]
自动填充固定行数的,GridView_[Asp.Net教程]
Sqlserver负载测试性能调整的魔法_[SQL,Server教程]
SQL,Server,索引结构及其使用(三)_[SQL,Server教程]
Sql连接查询_mssql学习_编程技术
Visual C++ 6.0教程:c++程序的组成之常量与变量
剖析SQL Server2005 SQLCLR代码安全性_[SQL Server教程]
详解网页制作中使用的HTML常用标记_[Html教程]
C#中多维数组的声明
Reading number is top 10 pictures
The world's top ten most beautiful railway station1
NeedWallpaper4
Beautiful Japanese beauty(漂亮的日本美女)3
Absolutely shocked. National geographic 50 animal photographys4
男人们都在想什么
The terra-cotta warriors2
The real super beauty8
漂亮的跳舞妹妹1
福利福利。。。。。。
Sora aoi mirror memorial classics1
Download software ranking
Sora aoi 120 minutes
Proficient in JavaScript
Unix video tutorial8
Call Of Duty2
软件工程思想
Eclipse-CALMSANNY (second edition)
Boxer's Top ten classic battle1
网络管理员第三版
仙剑奇侠传98版歌曲
WebService在.NET中的实战应用教学视频 → 第2集
qq published in(发表于) 2014/7/11 9:18:29 Edit(编辑)
C#中Windows Media Player控件使用实例

C#中Windows Media Player控件使用实例

C#中Windows Media Player控件使用实例|方法

Windows Media Player控件

Windows Media Player是一种媒体播放器,可以播放当前最流行的音频、视频文件和大多数混合型的多媒体文件。为了便于程序的开发,Visual Studio 2005集成开发环境提供了Windows Media Player控件,并且提供了相关的属性、方法,开发者根据提供的属性、方法完全可以实现Windows Media Player播放器的所有功能。

在使用Windows Media Player控件进行程序开发前,必须将Windows Media Player控件添加到工具箱中,步骤如下所示。

(1)选择工具箱,并单击鼠标右键,在弹出的快捷菜单中选择“选择项”。

(2)弹出“选择工具箱项”对话框,选择“COM组件”选项卡。

(3)在COM组件列表中,选择名称为“Windows Media Player”,单击【确定】按钮,Windows Media Player控件添加成功,如图1所示。



图1 添加Windows Media Player控件

表1和表2介绍Windows Media Player控件提供的主要属性和方法。



表1 Windows Media Player控件主要属性及说明

另外,将Windows Media Player控件添加到窗体上,在该控件上单击鼠标右键,弹出“Windows Media Player控件属性”对话框,为Windows Media Player控件提供中文属性对话框,如图2所示。



图2 Windows Media Player控件属性设置



表2 Windows Media Player控件主要方法及说明

示例

Windows Media Player控件制作多媒体播放器

本示例利用Windows Media Player控件来实现播放视频文件。程序运行结果如图3所示。



图3 多媒体播放器

程序开发步骤如下所示。

(1)创建一个项目,命名为27_02,设置默认窗体的Text属性为“网站源代码多媒体播放器”。

(2)在窗体上添加Windows Media Player控件和3个Button控件。

(3)程序代码如下。

sing System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace _7_02

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

OpenFileDialog openFile = new OpenFileDialog();

private void button1_Click(object sender, EventArgs e)

{//本教程来自:http://www.isstudy.com

openFile.ShowDialog();

}

private void button2_Click(object sender, EventArgs e)

{

axWindowsMediaPlayer1.URL = openFile.FileName;

}

private void button3_Click(object sender, EventArgs e)

{

axWindowsMediaPlayer1.close();

}

}

}

完整程序代码如下:

★ ★★★★Form1.cs窗体代码文件完整程序代码★★★★★

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace _7_02

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

OpenFileDialog openFile = new OpenFileDialog();

private void Form1_Load(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

openFile.ShowDialog();

}

private void button2_Click(object sender, EventArgs e)

{

axWindowsMediaPlayer1.URL = openFile.FileName;

}

private void button3_Click(object sender, EventArgs e)

{

axWindowsMediaPlayer1.close();

}

}

}

★ ★★★★Form1.Designer.cs窗体设计文件完整程序代码网站源代码★★★★★

namespace _7_02



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.