Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- namespace MusicPlayer
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
- {
- }
- string[] music, path;
- private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- axWindowsMediaPlayer1.URL = path[listBox1.SelectedIndex];
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- music = openFileDialog1.SafeFileNames;
- path = openFileDialog1.FileNames;
- for (var i = 1; i < music.Length; i++)
- {
- listBox1.Items.Add(music[i]);
- }
- }
- //DirectoryInfo dir = new DirectoryInfo("D:\\Музыка\\Легенды советской эстрады 70-80 годы");
- //FileInfo[] files = dir.GetFiles("*.mp3");
- //foreach (FileInfo fi in files)
- //{
- // listBox1.Items.Add(fi.ToString());
- //}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment