示例#1
0
 private void PlaylistView_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         DropDownMenu.Show(PointToScreen(e.Location));
     }
 }
示例#2
0
        private void PlaylistView_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (PlaylistView.SelectedIndices.Count == 0)
                {
                    return;
                }
                var Index = GetFocusedItem();
                var track = Tracks[Index];

                var Items = new Dictionary <string, ToolStripItem>();
                foreach (var item in MenuItems)
                {
                    DropDownMenu.Items.Remove(item);
                    Items.Add(item.Text, item);
                }

                if (track.Status == Track.StatusType.Local)
                {
                    DropDownMenu.Items.Insert(0, Items[Names.Play]);
                    DropDownMenu.Items.Insert(1, Items[Names.Pause]);
                    DropDownMenu.Items.Insert(2, Items[Names.Stop]);
                    DropDownMenu.Items.Insert(3, Items[Names.Numbers]);
                    if (track.IsM4a)
                    {
                        DropDownMenu.Items.Insert(4, Items[Names.ConvertMP3]);
                    }
                }
                else if (track.Status == Track.StatusType.Offline)
                {
                    DropDownMenu.Items.Insert(0, Items[Names.Play]);
                    DropDownMenu.Items.Insert(1, Items[Names.Title]);
                    DropDownMenu.Items.Insert(2, Items[Names.DAgain]);
                    DropDownMenu.Items.Insert(3, Items[Names.Numbers]);
                    DropDownMenu.Items.Insert(4, Items[Names.Dir]);
                    if (track.IsM4a)
                    {
                        DropDownMenu.Items.Insert(2, Items[Names.ConvertMP3]);
                    }
                }
                else if (track.Status == Track.StatusType.Online)
                {
                    DropDownMenu.Items.Insert(0, Items[Names.DP]);
                    DropDownMenu.Items.Insert(1, Items[Names.Title]);
                    DropDownMenu.Items.Insert(2, Items[Names.JDownload]);
                    DropDownMenu.Items.Insert(3, Items[Names.Numbers]);
                }

                var font = DropDownMenu.Items[0].Font;
                DropDownMenu.Items[0].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold);
                DropDownMenu.Show(PlaylistView.PointToScreen(e.Location));
            }
        }