Refactor grid column logic, lock designer controls
Refactored GridView5 column formatting to only show relevant columns and improve maintainability. Added .Locked metadata to many controls in frmMain.resx to enforce read-only state in the designer. Restored SVG images for XtraTabPages and updated TrayLocation metadata for components.
This commit is contained in:
@@ -481,7 +481,6 @@ Public Class frmMain
|
||||
Private Sub ToolStripButton10_Click(sender As Object, e As EventArgs) Handles ToolStripButton10.Click
|
||||
Load_Processes()
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton8_Click(sender As Object, e As EventArgs) Handles ToolStripButton8.Click
|
||||
Try
|
||||
TBEMLP_POLL_PROCESSBindingSource.EndEdit()
|
||||
@@ -1060,34 +1059,25 @@ Public Class frmMain
|
||||
If gv IsNot Nothing Then
|
||||
gv.PopulateColumns()
|
||||
|
||||
Try
|
||||
If gv.Columns.ColumnByFieldName("GUID") IsNot Nothing Then gv.Columns("GUID").Width = 50
|
||||
Catch
|
||||
End Try
|
||||
Try
|
||||
If gv.Columns.ColumnByFieldName("WORK_PROCESS") IsNot Nothing Then gv.Columns("WORK_PROCESS").Width = 140
|
||||
Catch
|
||||
End Try
|
||||
Try
|
||||
If gv.Columns.ColumnByFieldName("EMAIL_MSGID") IsNot Nothing Then gv.Columns("EMAIL_MSGID").Width = 280
|
||||
Catch
|
||||
End Try
|
||||
Try
|
||||
If gv.Columns.ColumnByFieldName("EMAIL_FROM") IsNot Nothing Then gv.Columns("EMAIL_FROM").Width = 240
|
||||
Catch
|
||||
End Try
|
||||
Try
|
||||
If gv.Columns.ColumnByFieldName("EMAIL_SUBJECT") IsNot Nothing Then gv.Columns("EMAIL_SUBJECT").Width = 400
|
||||
Catch
|
||||
End Try
|
||||
Try
|
||||
If gv.Columns.ColumnByFieldName("EMAIL_DATE") IsNot Nothing Then
|
||||
gv.Columns("EMAIL_DATE").DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime
|
||||
gv.Columns("EMAIL_DATE").DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss"
|
||||
gv.Columns("EMAIL_DATE").Width = 160
|
||||
' Hide all columns first
|
||||
For Each column As DevExpress.XtraGrid.Columns.GridColumn In gv.Columns
|
||||
column.Visible = False
|
||||
Next
|
||||
|
||||
' Show only the desired columns
|
||||
Dim visibleColumns = New String() {"GUID", "EMAIL_MSGID", "EMAIL_FROM", "EMAIL_SUBJECT", "EMAIL_DATE", "ADDED_WHEN", "STATUS", "PROFILE_ID"}
|
||||
For Each columnName In visibleColumns
|
||||
Dim column = gv.Columns.ColumnByFieldName(columnName)
|
||||
If column IsNot Nothing Then
|
||||
column.Visible = True
|
||||
End If
|
||||
Catch
|
||||
End Try
|
||||
Next
|
||||
|
||||
' Optionally format specific columns
|
||||
If gv.Columns.ColumnByFieldName("EMAIL_DATE") IsNot Nothing Then
|
||||
gv.Columns("EMAIL_DATE").DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime
|
||||
gv.Columns("EMAIL_DATE").DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss"
|
||||
End If
|
||||
|
||||
gv.OptionsView.ColumnAutoWidth = False
|
||||
gv.BestFitColumns()
|
||||
|
||||
Reference in New Issue
Block a user