Index: ActiviteitenOpvolging/ActiviteitenOpvolging/Form1.vb =================================================================== diff -u -r1669 -r1673 --- ActiviteitenOpvolging/ActiviteitenOpvolging/Form1.vb (.../Form1.vb) (revision 1669) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/Form1.vb (.../Form1.vb) (revision 1673) @@ -1,7 +1,35 @@ Imports ActiviteitenOpvolging.configs Public Class Form1 + Private userControls As New List(Of UserControl1) + Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load - dim test = ConfigsLoader.GridLabelNames + Dim test = ConfigsLoader.GridLabelNames + + BackColor = Color.White + ForeColor = Color.Black + Size = New System.Drawing.Size(800, 600) + Text = "Run-time Controls" + StartPosition = FormStartPosition.CenterScreen + + For i As Integer = 0 To 4 + Dim userControl As New UserControl1 + With userControl + .Name = $"User control {i}" + .Text = $"User control {i}" + .Location = New Point(10, 10) + .Size = New System.Drawing.Size(300, 250) + .message = i + End With + + userControls.Add(userControl) + Me.FlowLayoutPanel1.Controls.Add(userControl) + Next End Sub + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + For each control In userControls + control.ChangeColor() + Next + End Sub End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.vb (revision 1673) @@ -0,0 +1,17 @@ +Public Class UserControl1 + Public message As String + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + MessageBox.Show($"This is a test, I'm user control {message}.") + End Sub + + Public Sub ChangeColor() + BackColor = If(BackColor = Color.White, Color.Black, Color.White) + ForeColor = If(BackColor = Color.White, Color.Black, Color.White) + End Sub + + Private Sub UserControl1_Load(sender As Object, e As EventArgs) Handles MyBase.Load + BackColor = Color.White + ForeColor = Color.Black + End Sub +End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj =================================================================== diff -u -r1669 -r1673 --- ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj (.../ActiviteitenOpvolging.vbproj) (revision 1669) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj (.../ActiviteitenOpvolging.vbproj) (revision 1673) @@ -86,6 +86,7 @@ Form + True @@ -101,6 +102,12 @@ Settings.settings True + + UserControl1.vb + + + UserControl + @@ -112,6 +119,9 @@ My.Resources Designer + + UserControl1.vb + Index: ActiviteitenOpvolging/ActiviteitenOpvolging/grids/IUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/grids/IUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/grids/IUserControl.vb (revision 1673) @@ -0,0 +1,3 @@ +Public Interface IDataGridUserControl + +End Interface Index: ActiviteitenOpvolging/ActiviteitenOpvolging/Form1.Designer.vb =================================================================== diff -u -r1669 -r1673 --- ActiviteitenOpvolging/ActiviteitenOpvolging/Form1.Designer.vb (.../Form1.Designer.vb) (revision 1669) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/Form1.Designer.vb (.../Form1.Designer.vb) (revision 1673) @@ -22,17 +22,43 @@ 'Do not modify it using the code editor. _ Private Sub InitializeComponent() + Me.FlowLayoutPanel1 = New System.Windows.Forms.FlowLayoutPanel() + Me.Button1 = New System.Windows.Forms.Button() Me.SuspendLayout ' + 'FlowLayoutPanel1 + ' + Me.FlowLayoutPanel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) + Me.FlowLayoutPanel1.Location = New System.Drawing.Point(12, 12) + Me.FlowLayoutPanel1.Name = "FlowLayoutPanel1" + Me.FlowLayoutPanel1.Size = New System.Drawing.Size(776, 469) + Me.FlowLayoutPanel1.TabIndex = 0 + ' + 'Button1 + ' + Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) + Me.Button1.Location = New System.Drawing.Point(367, 487) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(75, 23) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Button1" + Me.Button1.UseVisualStyleBackColor = true + ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(800, 450) + Me.ClientSize = New System.Drawing.Size(800, 522) + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.FlowLayoutPanel1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(false) End Sub + Friend WithEvents FlowLayoutPanel1 As FlowLayoutPanel + Friend WithEvents Button1 As Button End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.resx =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.resx (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.resx (revision 1673) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.Designer.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.Designer.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/UserControl1.Designer.vb (revision 1673) @@ -0,0 +1,62 @@ + _ +Partial Class UserControl1 + Inherits System.Windows.Forms.UserControl + + 'UserControl overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.DataGridView1 = New System.Windows.Forms.DataGridView() + Me.Button1 = New System.Windows.Forms.Button() + CType(Me.DataGridView1,System.ComponentModel.ISupportInitialize).BeginInit + Me.SuspendLayout + ' + 'DataGridView1 + ' + Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize + Me.DataGridView1.Location = New System.Drawing.Point(35, 36) + Me.DataGridView1.Name = "DataGridView1" + Me.DataGridView1.Size = New System.Drawing.Size(240, 150) + Me.DataGridView1.TabIndex = 0 + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(81, 192) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(141, 42) + Me.Button1.TabIndex = 1 + Me.Button1.Text = "Button1" + Me.Button1.UseVisualStyleBackColor = true + ' + 'UserControl1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.DataGridView1) + Me.Name = "UserControl1" + Me.Size = New System.Drawing.Size(300, 250) + CType(Me.DataGridView1,System.ComponentModel.ISupportInitialize).EndInit + Me.ResumeLayout(false) + +End Sub + + Friend WithEvents DataGridView1 As DataGridView + Friend WithEvents Button1 As Button +End Class