public frmThreadDescription()
 {
     InitializeComponent();
     Gui.SetFontAndScaling(this);
 }
 private void frmDownloads_Shown(object sender, EventArgs e)
 {
     Gui.EnsureScrollBarVisible(lvDownloads);
 }
 public frmSettings()
 {
     InitializeComponent();
     Gui.SetFontAndScaling(this);
 }
        private void BuildColumnHeaderMenu()
        {
            ContextMenu contextMenu = new ContextMenu();

            contextMenu.Popup += (s, e) => {
                for (int i = 0; i < lvThreads.Columns.Count; i++)
                {
                    contextMenu.MenuItems[i].Checked = lvThreads.Columns[i].Width != 0;
                }
            };
            for (int i = 0; i < lvThreads.Columns.Count; i++)
            {
                MenuItem menuItem = new MenuItem {
                    Index = i,
                    Tag   = i,
                    Text  = lvThreads.Columns[i].Text
                };
                menuItem.Click += (s, e) => {
                    int          iColumn = (int)((MenuItem)s).Tag;
                    ColumnHeader column  = lvThreads.Columns[iColumn];
                    if (column.Tag == null)
                    {
                        column.Tag   = column.Width;
                        column.Width = 0;
                    }
                    else
                    {
                        column.Width = (int)column.Tag;
                        column.Tag   = null;
                    }
                };
                contextMenu.MenuItems.Add(menuItem);
            }
            ContextMenuStrip contextMenuStrip = new ContextMenuStrip();

            contextMenuStrip.Opening += (s, e) => {
                e.Cancel = true;
                Point pos = lvThreads.PointToClient(MousePosition);
                if (pos.X < 0 || pos.X > lvThreads.ClientSize.Width || pos.Y < 0 || pos.Y >= Gui.GetHeaderHeight(lvThreads))
                {
                    return;
                }
                contextMenu.Show(lvThreads, pos);
            };
            lvThreads.ContextMenuStrip = contextMenuStrip;
        }