Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb =================================================================== diff -u -r1682 -r1692 --- ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb (.../ActiviteitenOpvolgingForm.vb) (revision 1682) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb (.../ActiviteitenOpvolgingForm.vb) (revision 1692) @@ -40,7 +40,7 @@ Dim userControl As New DataGridViewUserControl(Me, gridNumber) 'Set other parameters. With userControl - .Size = New System.Drawing.Size(600, 250) + .Size = New System.Drawing.Size(ConfigsLoader.GridWidths(gridNumber), ConfigsLoader.GridHeights(gridNumber)) End With 'Add to list of user controls. Index: ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsLoader.vb =================================================================== diff -u -r1689 -r1692 --- ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsLoader.vb (.../ConfigsLoader.vb) (revision 1689) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsLoader.vb (.../ConfigsLoader.vb) (revision 1692) @@ -79,6 +79,18 @@ Return New List(Of String)(_gridLabelNames) End Get End Property + private ReadOnly _gridWidths As New List(Of Integer) + Public ReadOnly Property GridWidths As List(Of Integer) + Get + Return New List(Of Integer)(_gridWidths) + End Get + End Property + private ReadOnly _gridHeights As New List(Of Integer) + Public ReadOnly Property GridHeights As List(Of Integer) + Get + Return New List(Of Integer)(_gridHeights) + End Get + End Property Private ReadOnly _gridsColumnHeaderNames As New List(Of String()) Public ReadOnly Property GridColumnHeaderNames As List(Of String()) Get @@ -120,6 +132,14 @@ _NumberOfGrids = value ElseIf identifier.Contains("GridLabel") Then _gridLabelNames.Add(value) + ElseIf identifier.Contains("DimensionsGrid") Then + 'Split into width and height. + Dim values = value.Split("x") + 'Check if there are two values. + if values.Count() <> 2 Then Throw new ConfigurationException("The dimensions of a grid have an invalid format.") + 'Save values. + _gridWidths.Add(values(0)) 'Width + _gridHeights.Add(values(1)) 'Height ElseIf identifier.Contains("ColumnHeaderGrid") Then _gridsColumnHeaderNames.Add(value.Split(",")) ElseIf identifier.Contains("NumberOfActivitiesGrid") Then @@ -159,6 +179,12 @@ ElseIf _gridLabelNames.Count <> NumberOfGrids Then Throw New ConfigurationException("The amount of 'grid labels' is not equal to the 'number of grids'.") End If + 'Grid dimensions. + If _gridWidths.Count = 0 or _gridHeights.Count = 0 then + Throw New ConfigurationException("There are no grid dimensions defined.") + ElseIf _gridWidths.Count <> NumberOfGrids or _gridHeights.Count <> NumberOfGrids Then + Throw New ConfigurationException("The amount of 'grid dimensions' is not equal to the 'number of grids'.") + End If 'Column headers of grids. If _gridsColumnHeaderNames.Count = 0 Then Throw New ConfigurationException("There are no grid column header collections defined.")