private void Dlbe_MouseEnter(object sender, DuiMouseEventArgs e) { skinLine_Update(); DuiBaseControl lbbtn = sender as DuiBaseControl; string vtag = ""; foreach (var vitem in lbbtn.Controls) { DuiLabel lb = vitem as DuiLabel; vtag = lb.Tag.ToString(); if (lb.Name.Contains("ImageTypeName_")) { lb.ForeColor = defaultColor; } else { lb.BackColor = defaultColor; } } DuiBaseControl bControl = lbbtn.Parent as DuiBaseControl; foreach (var item in bControl.FindControl("ImageTypeGrid_" + vtag)) { if (item is DuiBaseControl && item.Controls.Count > 0 && Panel_TypeMess.DUIControls.Count <= 0) { DuiBaseControl newpm = new DuiBaseControl(); newpm.Size = item.Size; newpm.Visible = true; newpm.Location = new Point(0, 0); newpm.BackColor = item.BackColor; newpm.Borders = item.Borders; newpm.ShowBorder = item.ShowBorder; foreach (var vitem in item.Controls) { if (vitem is DuiLabel) { DuiLabel dl = vitem as DuiLabel; dl.Cursor = Cursors.Hand; dl.MouseEnter += dlTag_MouseEnter; dl.MouseLeave += dlTag_MouseLeave; newpm.Controls.Add(dl); } } newpm.Dock = DockStyle.Fill; Panel_TypeMess.DUIControls.Add(newpm); Panel_TypeMess.Size = item.Size; Panel_TypeMess.Location = new Point(item.Location.X, layeredPanel_top.Height + Panel_Type.Height - 5); Utils.AnimationControl.ShowControl(Panel_TypeMess, true, AnchorStyles.Right); } } Point ms = Control.MousePosition; x = ms.X; y = ms.Y; //NowNum = int.Parse(btn.Tag.ToString()); //LoadSliderImg(NowNum); Panel_Type.Refresh(); }
/// <summary> /// 图片列表失去焦点后的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dp_MouseLeave(object sender, EventArgs e) { Point ms = Control.MousePosition; if (ms.Y != y || (ms.X != x)) { DuiBaseControl dp = null; string strId = ""; if (sender is DuiBaseControl) { dp = sender as DuiBaseControl; if (dp.Name.Contains("btnBaseControl_")) { strId = (dp != null ? dp.Name.Replace("btnBaseControl_", "") : ""); } } if (sender is DuiButton) { dp = (sender as DuiButton).Parent as DuiBaseControl; strId = (sender as DuiButton).Name.Replace("btn_Download_", "").Replace("btn_Setting_", ""); } if (sender is DuiPictureBox) { strId = (sender as DuiPictureBox).Name.Replace("back_", ""); dp = (sender as DuiPictureBox).Parent as DuiBaseControl; } //隐藏按钮 if (dp.FindControl("btnBaseControl_" + strId).Count > 0) { DuiBaseControl ldl = dp.FindControl("btnBaseControl_" + strId)[0]; if (!ldl.IsMouseEnter) { ldl.Visible = false; //显示说明 if (dp.FindControl("imgTag_" + strId).Count > 0) { DuiLabel dl = (DuiLabel)dp.FindControl("imgTag_" + strId)[0]; dl.Visible = true; } } } } }
/// <summary> /// 图片列表获取焦点后的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dp_MouseEnter(object sender, EventArgs e) { Point ms = Control.MousePosition; x = ms.X; y = ms.Y; DuiBaseControl dp = null; string strId = ""; if (sender is DuiBaseControl) { dp = sender as DuiBaseControl; } if (sender is DuiButton) { dp = (sender as DuiButton).Parent as DuiBaseControl; strId = (sender as DuiButton).Name.Replace("btn_Download_", "").Replace("btn_Setting_", ""); } if (sender is DuiPictureBox) { strId = (sender as DuiPictureBox).Name.Replace("back_", ""); dp = (sender as DuiPictureBox).Parent as DuiBaseControl; } //隐藏说明 if (dp.FindControl("imgTag_" + strId).Count > 0) { DuiLabel dl = (DuiLabel)dp.FindControl("imgTag_" + strId)[0]; dl.Visible = false; //dl.Location = new Point(2, 2); } //显示按钮 if (dp.FindControl("btnBaseControl_" + strId).Count > 0) { DuiBaseControl ldl = dp.FindControl("btnBaseControl_" + strId)[0]; ldl.Visible = true; } }
public void SetIsPlayingAb(string name, Image i, string listname = "") { if (IsInList(name)) { if (listname != "") { foreach (DuiBaseControl b in InnerDuiControl.FindControl(name)) { //System.Windows.Forms.MessageBox.Show(b.Tag.ToString()); if (b.Tag.ToString() == listname) { ((DuiPictureBox)b.FindControl("albumpic")[0]).BackgroundImage = i; } } } else { DuiBaseControl b = InnerDuiControl.FindControl(name)[0]; ((DuiPictureBox)b.FindControl("albumpic")[0]).BackgroundImage = i; } } }
public MusicItem AddItem(string name, string listname, bool b = false) { MusicItem se = null; bool Searched = false; foreach (MusicListItem iy in Groups) { if (iy.Name == listname) { Searched = true; } } if (Searched) { if (IsInList(name, listname)) { return(null); } else { int a = 0; for (int i = 0; i < Items.Count; i++) { if (Items[i].Tag != null) { if (Items[i].Tag.ToString() == listname) { a = a + 1; } } } DuiBaseControl ix = null; foreach (DuiBaseControl ixx in Items) { if (ixx.Name.Replace("list_", "") == listname) { ix = ixx; } } if (File.Exists(name)) { #region 本地音乐 Mp3Info info = MP3Info.GetMp3Info(name); string artists = info.Artist; string album = info.Album; string length = info.MusicLength; string title = info.Title; DuiLabel infoforsinger = new DuiLabel(); infoforsinger.TextRenderMode = System.Drawing.Text.TextRenderingHint.AntiAlias; infoforsinger.Size = new Size(140, 20); if (artists != "") { infoforsinger.Text = "-" + artists; } infoforsinger.Location = new Point(160, 4); infoforsinger.ForeColor = Color.FromArgb(220, 220, 220); infoforsinger.Font = new Font("微软雅黑", 9F); infoforsinger.Name = "infoforsinger"; DuiPictureBox albumpic = new DuiPictureBox(); albumpic.Size = new Size(50, 50); albumpic.Location = new Point(5, 0); albumpic.Name = "albumpic"; albumpic.BackgroundImage = Properties.Resources.default_album; albumpic.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; albumpic.Visible = false; DuiLabel infoforTimer = new DuiLabel(); infoforTimer.Size = new Size(70, 20); infoforTimer.Text = length; infoforTimer.Location = new Point(350, 4); infoforTimer.ForeColor = Color.FromArgb(255, 255, 255); infoforTimer.Font = new Font("微软雅黑", 9F); infoforTimer.Name = "infoforTimer"; infoforTimer.TextRenderMode = System.Drawing.Text.TextRenderingHint.AntiAlias; DuiButton btnplay = new DuiButton(); btnplay.Size = new Size(20, 20); btnplay.Location = new Point(295, 3); btnplay.NormalImage = Properties.Resources.list_btn_play_normal; btnplay.HoverImage = Properties.Resources.list_btn_play_hover; btnplay.PressedImage = Properties.Resources.list_btn_play_press; btnplay.MouseClick += Btnplay_MouseDown; btnplay.MouseEnter += Btnplay_MouseEnter; btnplay.MouseLeave += Btnplay_MouseLeave; btnplay.Name = "btnplay"; btnplay.Tag = name; btnplay.Visible = false; DuiButton btnpause = new DuiButton(); btnpause.Size = new Size(20, 20); btnpause.Location = new Point(295, 3); btnpause.NormalImage = Properties.Resources.list_btn_pause_normal; btnpause.HoverImage = Properties.Resources.list_btn_pause_hover; btnpause.PressedImage = Properties.Resources.list_btn_pause_press; btnpause.MouseClick += Btnpause_MouseClick; btnpause.Name = "btnpause"; btnpause.Tag = name; btnpause.MouseEnter += Btnpause_MouseEnter; btnpause.MouseLeave += Btnpause_MouseLeave; btnpause.Visible = false; DuiButton btndel = new DuiButton(); btndel.Size = new Size(20, 20); btndel.Location = new Point(317, 3); btndel.NormalImage = Properties.Resources.btn_del_h; btndel.HoverImage = Properties.Resources.btn_del_n; btndel.PressedImage = Properties.Resources.btn_del_p; btndel.MouseClick += Btndel_MouseClick; btndel.MouseEnter += Btndel_MouseEnter; btndel.MouseLeave += Btndel_MouseLeave; btndel.Name = "btndel"; btndel.Tag = listname; btndel.Visible = false; DuiLabel lbl = new DuiLabel(); lbl.TextRenderMode = System.Drawing.Text.TextRenderingHint.AntiAlias; lbl.Size = new System.Drawing.Size(160, 17); if (Path.GetFileNameWithoutExtension(name).Length > 14) { lbl.Text = Path.GetFileNameWithoutExtension(name).Remove(13).Insert(13, "..."); lbl.Tag = Path.GetFileNameWithoutExtension(name); lbl.MouseEnter += Lbl_MouseEnter; lbl.MouseLeave += Lbl_MouseLeave; } else { lbl.Text = Path.GetFileNameWithoutExtension(name); lbl.Tag = Path.GetFileNameWithoutExtension(name); } lbl.Location = new Point(10, 4); lbl.ForeColor = Color.FromArgb(255, 255, 255); lbl.Font = new Font("微软雅黑", 9F); lbl.Name = "lbl"; DuiBaseControl listx = new DuiBaseControl(); listx.BackColor = Color.FromArgb(0, Color.Black); listx.Width = Width; listx.Height = 25; listx.Controls.Add(lbl); listx.Controls.Add(infoforsinger); listx.Controls.Add(infoforTimer); listx.Controls.Add(btndel); listx.Controls.Add(btnplay); listx.Controls.Add(btnpause); listx.Controls.Add(albumpic); listx.MouseDown += Listx_MouseDown; listx.MouseUp += Listx_MouseUp; listx.MouseMove += Listx_MouseMove; listx.MouseEnter += Listx_MouseEnter; listx.MouseLeave += Listx_MouseLeave; listx.MouseDoubleClick += Listx_MouseDoubleClick; listx.MouseClick += Listx_MouseClick; listx.Name = name; listx.Height = 25; listx.Tag = listname; if (!b) { Items.Add(listx); } else { Items.Insert(Items.IndexOf(ix) + a + 1, listx); } foreach (MusicListItem iy in Groups) { if (iy.Name == listname) { MusicItem m = new MusicItem(); m.Path = name; m.IsOnline = false; m.ParentName = listname; if (title != "") { m.Name = title; } else { m.Name = lbl.Tag.ToString(); } m.Singer = artists; iy.musics.Add(m); } } if (OpenedList == listname) { listx.Visible = true; } else { listx.Visible = false; } #endregion } else { #region 失效音乐 DuiLabel infoforTimer = new DuiLabel(); infoforTimer.Size = new Size(70, 20); infoforTimer.Text = "文件失效"; infoforTimer.Location = new Point(350, 4); infoforTimer.ForeColor = Color.Red; infoforTimer.Font = new Font("微软雅黑", 9F); infoforTimer.Name = "infoforTimer"; infoforTimer.TextRenderMode = System.Drawing.Text.TextRenderingHint.AntiAlias; DuiButton btndel = new DuiButton(); btndel.Size = new Size(20, 20); btndel.Location = new Point(317, 3); btndel.NormalImage = Properties.Resources.btn_del_h; btndel.HoverImage = Properties.Resources.btn_del_n; btndel.PressedImage = Properties.Resources.btn_del_p; btndel.MouseClick += Btndel_MouseClick; btndel.MouseEnter += Btndel_MouseEnter; btndel.MouseLeave += Btndel_MouseLeave; btndel.Name = "btndel"; btndel.Tag = listname; btndel.Visible = false; DuiLabel lbl = new DuiLabel(); lbl.TextRenderMode = System.Drawing.Text.TextRenderingHint.AntiAlias; lbl.Size = new System.Drawing.Size(160, 20); if (Path.GetFileNameWithoutExtension(name).Length > 14) { lbl.Text = Path.GetFileNameWithoutExtension(name).Remove(13).Insert(13, "..."); lbl.MouseEnter += Lbl_MouseEnter; } else { lbl.Text = Path.GetFileNameWithoutExtension(name); } lbl.Location = new Point(10, 4); lbl.ForeColor = Color.Red; lbl.Font = new Font("微软雅黑", 9F); lbl.Name = "lbl"; lbl.Tag = Path.GetFileNameWithoutExtension(name); lbl.MouseLeave += Lbl_MouseLeave; DuiBaseControl listx = new DuiBaseControl(); listx.BackColor = Color.FromArgb(0, Color.Black); listx.Width = Width; listx.Height = 25; listx.Controls.Add(lbl); listx.Controls.Add(infoforTimer); listx.Controls.Add(btndel); listx.MouseMove += Listx_MouseMove; listx.MouseDown += Listx_MouseDown; listx.MouseUp += Listx_MouseUp; listx.MouseEnter += Listx_MouseEnterLose; listx.MouseLeave += Listx_MouseLeaveLose; listx.Name = name; listx.Height = 25; listx.Tag = listname; if (!b) { Items.Add(listx); } else { Items.Insert(Items.IndexOf(ix) + a + 1, listx); } foreach (MusicListItem iy in Groups) { if (iy.Name == listname) { MusicItem m = new MusicItem(); m.Path = name; m.IsOnline = false; iy.musics.Add(m); } } if (OpenedList == listname) { listx.Visible = true; } else { listx.Visible = false; } #endregion } a = a + 1; if (a == 0) { ((DuiLabel)ix.FindControl("Count")[0]).Text = "[这个列表没有歌曲,可以直接把歌曲拖到这里来哦]"; } else { ((DuiLabel)ix.FindControl("Count")[0]).Text = "[" + a.ToString() + "]"; } RefreshList(); } } GC.Collect(); return(se); }