Add save/restore layout buttons to Monitoring grid

Added "Save Layout" and "Restore Default Layout" buttons to the Monitoring tab, allowing users to save and restore the grid layout for GridView5. The layout is persisted as an XML file in the user's app data directory. On form load, the layout is restored if the file exists. Button event handlers provide user feedback, and control positions were adjusted to fit the new buttons.
This commit is contained in:
OlgunR
2026-01-27 13:31:15 +01:00
parent c2e7d06c4c
commit 5d4cdb2814
2 changed files with 59 additions and 14 deletions

View File

@@ -98,6 +98,11 @@ Public Class frmMain
txtMonitoringConfig.Text = "500"
End If
LoadMonitoringIntoGrid()
Dim layoutPath As String = System.IO.Path.Combine(Application.UserAppDataPath, "gridMonitoringLayout.xml")
If System.IO.File.Exists(layoutPath) Then
GridView5.RestoreLayoutFromXml(layoutPath)
End If
End Sub
Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
@@ -1087,4 +1092,20 @@ Public Class frmMain
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click
LoadMonitoringIntoGrid()
End Sub
Private Sub btnSaveLayout_Click(sender As Object, e As EventArgs) Handles btnSaveLayout.Click
Dim layoutPath As String = System.IO.Path.Combine(Application.UserAppDataPath, "gridMonitoringLayout.xml")
GridView5.SaveLayoutToXml(layoutPath)
MessageBox.Show("Layout gespeichert!")
End Sub
Private Sub btnRestoreDefaultLayout_Click(sender As Object, e As EventArgs) Handles btnRestoreDefaultLayout.Click
Dim layoutPath As String = System.IO.Path.Combine(Application.UserAppDataPath, "gridMonitoringLayout.xml")
If System.IO.File.Exists(layoutPath) Then
System.IO.File.Delete(layoutPath)
End If
' Grid neu laden, damit das Defaultlayout angezeigt wird
LoadMonitoringIntoGrid()
MessageBox.Show("Standardlayout wurde wiederhergestellt!")
End Sub
End Class