Last change
on this file since 3610 was
3316,
checked in by mkommend, 15 years ago
|
added possibility to change visibility of columns in StringConvertibleMatrixView (ticket #968)
|
File size:
1.1 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Data;
|
---|
5 | using System.Drawing;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Windows.Forms;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.Data.Views {
|
---|
11 | public partial class ColumnsVisibilityDialog : Form {
|
---|
12 | public ColumnsVisibilityDialog() {
|
---|
13 | InitializeComponent();
|
---|
14 | }
|
---|
15 |
|
---|
16 | public ColumnsVisibilityDialog(IEnumerable<DataGridViewColumn> columns) :this() {
|
---|
17 | this.Columns = columns;
|
---|
18 | }
|
---|
19 |
|
---|
20 | private List<DataGridViewColumn> columns;
|
---|
21 | public IEnumerable<DataGridViewColumn> Columns {
|
---|
22 | get { return this.columns; }
|
---|
23 | set {
|
---|
24 | this.columns = new List<DataGridViewColumn>(value);
|
---|
25 | UpdateCheckBoxes();
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | private void UpdateCheckBoxes() {
|
---|
30 | this.checkedListBox.Items.Clear();
|
---|
31 | foreach (DataGridViewColumn column in columns)
|
---|
32 | checkedListBox.Items.Add(column.HeaderText, column.Visible);
|
---|
33 | }
|
---|
34 |
|
---|
35 | private void checkedListBox_ItemCheck(object sender, ItemCheckEventArgs e) {
|
---|
36 | this.columns[e.Index].Visible = e.NewValue == CheckState.Checked;
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.