@@ -90,11 +90,18 @@ internal void ApplySettingsToGrid()
90
90
mnuQuickFilter . Checked = form . settings . Results . QuickFilter ;
91
91
mnuPagingCookie . Checked = form . settings . Results . PagingCookie ;
92
92
93
- mnuIdCol . Enabled = ! form . settings . Results . WorkWithLayout ;
94
- mnuIndexCol . Enabled = ! form . settings . Results . WorkWithLayout ;
95
- mnuNullCol . Enabled = ! form . settings . Results . WorkWithLayout ;
96
- mnuSysCol . Enabled = ! form . settings . Results . WorkWithLayout ;
97
-
93
+ mnuIdCol . Visible = ! form . settings . Results . WorkWithLayout ;
94
+ mnuIndexCol . Visible = ! form . settings . Results . WorkWithLayout ;
95
+ mnuNullCol . Visible = ! form . settings . Results . WorkWithLayout ;
96
+ mnuSysCol . Visible = ! form . settings . Results . WorkWithLayout ;
97
+ mnuResetLayout . Visible = form . settings . Results . WorkWithLayout && ! string . IsNullOrWhiteSpace ( crmGridView1 . LayoutXML ) ;
98
+ mnuShowAllCol . Visible = form . settings . Results . WorkWithLayout ;
99
+ mnuShowLayoutXML . Visible = form . settings . Results . WorkWithLayout ;
100
+
101
+ if ( ! form . settings . Results . WorkWithLayout )
102
+ {
103
+ crmGridView1 . LayoutXML = null ;
104
+ }
98
105
crmGridView1 . ShowFriendlyNames = mnuFriendly . Checked ;
99
106
crmGridView1 . ShowBothNames = mnuBothNames . Checked ;
100
107
crmGridView1 . ShowIdColumn = mnuIdCol . Checked ;
@@ -107,7 +114,6 @@ internal void ApplySettingsToGrid()
107
114
crmGridView1 . Service = form . Service ;
108
115
panQuickFilter . Visible = mnuQuickFilter . Checked ;
109
116
gbPagingCookie . Visible = mnuPagingCookie . Checked ;
110
- mnuResetLayout . Visible = form . settings . Results . WorkWithLayout ;
111
117
RefreshData ( ) ;
112
118
}
113
119
@@ -164,6 +170,10 @@ private void ShowHiddenColumns()
164
170
. Where ( c => ! c . Name . StartsWith ( "#" ) && ! c . Visible )
165
171
. ToList ( )
166
172
. ForEach ( c => c . Visible = true ) ;
173
+ crmGridView1 . Columns . Cast < DataGridViewColumn > ( )
174
+ . Where ( c => c . Visible && c . Width < 10 )
175
+ . ToList ( )
176
+ . ForEach ( c => c . Width = 100 ) ;
167
177
}
168
178
169
179
internal void SetQueryIfChangesDesign ( )
@@ -176,7 +186,7 @@ internal void SetQueryIfChangesDesign()
176
186
177
187
internal void SetLayoutToGrid ( )
178
188
{
179
- if ( form . dockControlBuilder ? . LayoutXML ? . Cells == null )
189
+ if ( ! form . settings . Results . WorkWithLayout || form . dockControlBuilder ? . LayoutXML ? . Cells == null )
180
190
{
181
191
return ;
182
192
}
@@ -408,5 +418,22 @@ private void mnuPage_KeyPress(object sender, KeyPressEventArgs e)
408
418
mnuRecordsNumbers . Focus ( ) ;
409
419
}
410
420
}
421
+
422
+ private void mnuAutoSizeAll_Click ( object sender , EventArgs e )
423
+ {
424
+ crmGridView1 . AutoResizeColumns ( DataGridViewAutoSizeColumnsMode . DisplayedCells ) ;
425
+ GetLayoutFromGrid ( ) ;
426
+ }
427
+
428
+ private void mnuShowAllCol_Click ( object sender , EventArgs e )
429
+ {
430
+ ShowHiddenColumns ( ) ;
431
+ GetLayoutFromGrid ( ) ;
432
+ }
433
+
434
+ private void mnuShowLayoutXML_Click ( object sender , EventArgs e )
435
+ {
436
+ form . ShowLayoutXML ( ) ;
437
+ }
411
438
}
412
439
}
0 commit comments