zoukankan      html  css  js  c++  java
  • 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="无声";
                }
            }

        }
    }

  • 相关阅读:
    超值干货:微服务架构下如何解耦,对于已经紧耦合下如何重构?
    程序员收藏不看系列:近三万字总结Spring注解开发!
    干货收藏:6 款能挣钱的 Spring Boot 开源后台管理系统
    美团二面:你向 Mysql 数据库插入 100w 条数据用了多久?
    5分钟快速掌握阿里内部MySQL性能优化的核心技术!
    优秀!一鼓作气学会“一致性哈希”,就靠这 18 张图了
    分库分表神器 Sharding-JDBC,几千万的数据你不搞一下?
    熬夜肝出5大点,18张图带你彻底弄懂MySQL事务日志
    jdk8新特性Stream
    java多线程
  • 原文地址:https://www.cnblogs.com/lykbk/p/54675464564trytyyt.html
Copyright © 2011-2022 走看看