/// <summary> /// Sets a column visible or invisible and saves the user preferences /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ColumnSelect(object sender, EventArgs e) { ColumnSelectMenuItem columnMenu = (ColumnSelectMenuItem)sender; columnMenu.Checked = !columnMenu.Checked; columnMenu.Column.Visible = columnMenu.Checked; SaveColumnsState(); }
/// <summary> /// Creates an array of menu items corresponding with the columns of the request list /// </summary> /// <returns></returns> private ColumnSelectMenuItem[] GetColumnMenuEntries() { ColumnSelectMenuItem[] entries = new ColumnSelectMenuItem[_dataGrid.Columns.Count]; for (int i = 0; i < entries.Length; i++) { entries[i] = new ColumnSelectMenuItem(); entries[i].Click += new EventHandler(ColumnSelect); entries[i].Column = _dataGrid.Columns[i]; } return(entries); }