분노의 챔질

C# Windows Media Player 사용하기 본문

Programming/C#

C# Windows Media Player 사용하기

분노의블로그 2023. 1. 11. 09:52
반응형

 

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 WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.Ctlcontrols.play();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            axWindowsMediaPlayer1.Ctlcontrols.stop();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog dlg = new OpenFileDialog();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    axWindowsMediaPlayer1.URL = dlg.FileName;
                    axWindowsMediaPlayer1.Ctlcontrols.stop();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
반응형

'Programming > C#' 카테고리의 다른 글

UltraGrid에서 Ctrl+C  (0) 2021.04.13
C# 키보드 마우스 후킹 HOOK  (0) 2018.07.04
C# 진수변환  (0) 2017.04.27
VB함수를 C#으로  (1) 2011.11.15
16진수 변환  (0) 2011.01.25