Hello !
Comme je le dis dans le titre de mon post, j'aimerai rendre une colonne invisible.
A titre informatif je remplis mon DataGrid par une ArrayList
Vu que je sais pas si ça change grand chose, je vous mets un bout de code
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 this.dataGrid_User.DataSource = maSourceArrayList; this.dataGrid_User.CaptionVisible = false; DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = "ArrayList"; int colwidth = (this.dataGrid_User.ClientSize.Width - ts.RowHeaderWidth - SystemInformation.VerticalScrollBarWidth - 5) / 2; DataGridTextBoxColumn cs = new DataGridTextBoxColumn(); cs.MappingName = "Id"; // Public property name cs.HeaderText = "ID"; //cs.Width = colwidth; Astuce barbare cs.Width = 0; ts.GridColumnStyles.Add(cs); .... // Add the custom tablestyle to the DataGrid this.dataGrid_User.TableStyles.Clear(); this.dataGrid_User.TableStyles.Add(ts);
Partager