private void LabelLayout(List <Song> LstSong) { if (LstSong.Count < 1) { this.Songlist.FlowLayoutPanel.Controls.Clear(); Label label = new Label(); label.Location = new Point(0, 0); label.Text = " 没有找到相关歌曲"; label.ForeColor = itemColor; label.FlatStyle = FlatStyle.Flat; label.AutoSize = false; label.Size = new Size(Songlist.Width - 20, 31); label.TextAlign = ContentAlignment.MiddleCenter; this.Songlist.FlowLayoutPanel.Controls.Add(label); return; } this.Songlist.FlowLayoutPanel.Controls.Clear(); foreach (Song song in LstSong) { ItemSong item = new ItemSong(song.Filename, CastToFen(song.DurationStr), song.MvHash); item.Size = new Size(Songlist.FlowLayoutPanel.Width - 20, 31); //item.BackColor = Color.Beige; item.DoubleClick += new EventHandler(this.ItemSongDoublick); item.MvIconClick += new ItemSong.Callback(MvIconClick); item.Tag = song; item.ContextMenuStrip = Menu; item.MouseLeave += new EventHandler(this.label1_MouseLeave); item.MouseEnter += new EventHandler(this.label1_MouseHover); Songlist.FlowLayoutPanel.Controls.Add(item); } Songlist.Refresh(); }
private void label1_MouseHover(object sender, EventArgs e) { ItemSong label = (ItemSong)sender; Song a = new Song(); a = (Song)label.Tag; selectnow = a; toast.SetToolTip(label, "歌曲名称: " + a.Filename + "\n歌手: " + a.Singername + "\n时长: " + CastToFen(a.DurationStr)); label.BackgroundImage = Image.FromFile(Application.StartupPath + "\\System\\Static\\long.png"); }
private void label1_MouseLeave(object sender, EventArgs e) { ItemSong label = (ItemSong)sender; Song s = (Song)label.Tag; if (selectnow != null) { //if (!s.Hash.Equals(selectnow.Hash)) //{ //} } label.BackgroundImage = null; }
private void Down_Click(object sender, EventArgs e) { ItemSong l = Menu.SourceControl as ItemSong; Song s = new Song(); //s = (Song)l.Tag; //if (File.Exists(audioPath + s.Filename + "." + s.Extname)) //{ // MessageBox.Show("已存在的歌曲,点击查看。"); // System.Diagnostics.Process.Start("Explorer.exe", Application.StartupPath + "\\Songs\\Audio"); // return; //} //string url = k.getinfo(s.Hash); //string JsonText = h.getJsonText(url); //string src = h.getUrl(JsonText); //if (src != null) //{ // down.main = this; // down.s = s; // //down.px = DownManager; // l.ForeColor = Color.Gray; // if (File.Exists(audioPath + s.Filename + "." + s.Extname)) // { // MessageBox.Show("已存在的歌曲,点击查看。"); // System.Diagnostics.Process.Start("Explorer.exe", Application.StartupPath + "\\Songs\\Audio"); // // down.Hide(); // } // else // { // down.add(s); // // down.Show(); // } //} //else //{ // MessageBox.Show("该歌曲收到限制!"); //} }
private void searchBar1_callBackText(object sender, object input, string inputStr) { listView(); List <Song> Songs = new List <Song>(); Songs = http.GetList(http.getJsonText(kugouApi.list(inputStr))); // Console.WriteLine(0); // Song s = Songs[0]; fxyy.Dock = DockStyle.Fill; listView1.pages.Controls.Add(fxyy); fxyy.fxyyList.Items.Clear(); int i = 0; foreach (var item in Songs) { ItemSong its = new ItemSong(item, SongdouClick, MvIconClick); its.Tag = item; its.Width = fxyy.fxyyList.Width; i++; if (Songs.IndexOf(item) % 2 == 0) { its.BackColor = Color.FromArgb(227, 227, 229); } fxyy.fxyyList.Items.Add(its); } }