private void clickPlayList_Click(object sender, EventArgs e) { playListItem click = (playListItem)sender; playFileLocation = click.filePath; playFile(); }
private void pnlPlayList_DragDrop(object sender, DragEventArgs e) { string[] droppedFilePaths = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string droppedFilePath in droppedFilePaths) { if (Path.GetExtension(droppedFilePath) == ".mp3") { playListItem newPlaylistItem = new playListItem(droppedFilePath, clickPlayList_Click); newPlaylistItem.Location = new System.Drawing.Point(0, playList.Count() * newPlaylistItem.Size.Height); playList.Add(newPlaylistItem); pnlPlayList.Controls.Add(newPlaylistItem); } } }