VitalyD

Untitled

Jun 30th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11.  
  12. namespace MusicPlayer
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
  22.         {
  23.  
  24.         }
  25.         string[] music, path;
  26.  
  27.         private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
  28.         {
  29.             axWindowsMediaPlayer1.URL = path[listBox1.SelectedIndex];
  30.         }
  31.  
  32.         private void button1_Click(object sender, EventArgs e)
  33.         {
  34.             if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  35.             {
  36.                 music = openFileDialog1.SafeFileNames;
  37.                 path = openFileDialog1.FileNames;
  38.  
  39.                 for (var i = 1; i < music.Length; i++)
  40.                 {
  41.                     listBox1.Items.Add(music[i]);
  42.                 }
  43.             }
  44.  
  45.             //DirectoryInfo dir = new DirectoryInfo("D:\\Музыка\\Легенды советской эстрады 70-80 годы");
  46.             //FileInfo[] files = dir.GetFiles("*.mp3");
  47.             //foreach (FileInfo fi in files)
  48.             //{
  49.             //   listBox1.Items.Add(fi.ToString());
  50.             //}
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment