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 button1_Click(object sender, EventArgs e) { Search(txt_Songname.Text.Trim()); Songlist.Refresh(); }