コード例 #1
0
        private void ClearPlayListPanel()
        {
            List <Control> controls = new List <Control>();

            foreach (Control control in PlayListPanel.Controls)
            {
                if (control.Name.Equals("PlayList") || control.Name.Equals("NewPlaylistPanel") || control.Name.Equals("PictureBoxExemplo"))
                {
                }
                else
                {
                    controls.Add(control);
                }
            }
            foreach (Control cont in controls)
            {
                PlayListPanel.Controls.Remove(cont);
            }
            PlayListPanel.Refresh();
        }
コード例 #2
0
        private void InitPlayLists()
        {
            PlaylistAdd.Visible = false;
            List <PlayList> playLists = app.User.myPlaylist;

            for (int i = 0; i < 7; i++)
            {
                if (playLists.Count - 1 < i)
                {
                    break;
                }
                listOfPictures[i].SizeMode    = PictureBoxSizeMode.Zoom;
                listOfPictures[i].Image       = playLists[i].Image;
                listOfPictures[i].Cursor      = Cursors.Hand;
                listOfPictures[i].Visible     = true;
                listOfPictures[i].Name        = playLists[i].PlaylistName;
                listOfPictures[i].MouseHover += new EventHandler(PlayListToolTip);
                listOfPictures[i].MouseClick += new MouseEventHandler(PlayList_Music);
                PlayListPanel.Controls.Add(listOfPictures[i]);
                PlayListPanel.Refresh();
            }
            if (playLists.Count >= 7)
            {
                PlaylistAdd.Visible = true;
                MessageBox.Show("Can't Add More");
            }
            else
            {
                listOfPictures[playLists.Count].SizeMode    = PictureBoxSizeMode.Zoom;
                listOfPictures[playLists.Count].Image       = Image.FromFile("..\\..\\Resources\\Add.png");
                listOfPictures[playLists.Count].Cursor      = Cursors.Hand;
                listOfPictures[playLists.Count].Visible     = true;
                listOfPictures[playLists.Count].MouseHover += new EventHandler(AddToolTip);
                listOfPictures[playLists.Count].MouseClick += new MouseEventHandler(AddNewPlayList);
                PlayListPanel.Controls.Add(listOfPictures[playLists.Count]);
                PlayListPanel.Refresh();
            }
        }