c# 如何制作RealPlayer 视频播放器

c# 如何制作RealPlayer 视频播放器

主要介绍了如何使用 RealPlayer G2 Control 控件

那么我们怎么获得到这个控件呢,很简单,操作方法如下

右单击工具箱对话框的【所有Windows窗体】标签页,在弹出浮动菜单中选择“选择项”则弹出【选择工具箱项】对话框在该对话框中切换到【Com 组件】标签页,

在列表试图中选择 RealPlayer G2 Control 选项 然后确定

则会自动在工具箱对话框【所有Windows窗体】标签页上新增加一个axRealAudiol控件像页面中拖动就可以了,

但是要注意:在默认状态下RealPlayer G2 Control控件不显示视频界面。 需要设置:

CtlControls 属性为”IMAGEWINDOW,CONTROLPANEL,STATUSBAR“后才能显示视频界面。

我简单做了一个样式大家可以看一下,实现了一些简单的操作,

代码如下:

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;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
 
        }

        private void button10_Click(object sender, EventArgs e)
        {
            //浏览
            OpenFileDialog mydol = new OpenFileDialog();
            if (mydol.ShowDialog() == DialogResult.OK)
            {
                this.axRealAudio1.Source=mydol.FileName;
            }
        }

        private void button11_Click(object sender, EventArgs e)
        {
            //播放
            if (this.axRealAudio1.CanPlay())
            {
                this.axRealAudio1.DoPlay();
            }
        }

        private void button12_Click(object sender, EventArgs e)
        {
            //停止
            if (this.axRealAudio1.CanStop())
            {
                this.axRealAudio1.DoStop();
            }
        }

        private void button13_Click(object sender, EventArgs e)
        {
            //暂停
            if (this.axRealAudio1.CanPlayPause())
            {
                this.axRealAudio1.DoPlayPause();
            }
        }

        private void button14_Click(object sender, EventArgs e)
        {
          //无声
            if (this.button14.Text == "无声")
            {
                this.axRealAudio1.SetMute(true);
                this.button14.Text = "有声";
            }
            else
            {
                this.axRealAudio1.SetMute(false);
                this.button14.Text="无声";
            }
        }

    }
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值