Hi
I am not sure if I understand your question, but it seems you want to apply control style properties from text (file) input.
Here is some code that sets up a few random controls and applies property values from strings (could be from file, but this example just uses dictionaries)
The idea here is that a control has an associated dictionary with the property name as the key and the property value(s) as a string.
In this example, there is a Label, Listbox1 and a ListBox2, each with some properties set by strings from the respective dictionary. (just as easy with text from a database/file whatever)
If this example is not relevant to your question, just ignore it.
Option Strict On
Option Explicit On
Public Class Form1
Dim WithEvents MyListBox1 As New ListBox
Dim WithEvents MyListBox2 As New ListBox
Dim MyLabel As New Label
Dim listbox1dic As New Dictionary(Of String, String)
Dim listbox2dic As New Dictionary(Of String, String)
Dim labdic As New Dictionary(Of String, String)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With labdic
.Add("Location", "50,50")
.Add("Text", "Freddy wuz heer")
.Add("AutoSize", "False")
.Add("Size", "120,40")
.Add("BackColor", "150,255,170,150")
End With
With listbox1dic
.Add("Location", "250,10")
.Add("Size", "180,340")
.Add("BackColor", "255,160,170,255")
End With
With listbox2dic
.Add("Location", "450,10")
.Add("Size", "180,340")
.Add("BackColor", "255,160,255,170")
End With
With MyListBox1
.MultiColumn = True
.ColumnWidth = 180
.DataSource = New BindingSource(listbox1dic, String.Empty)
.Location = GetLoc(listbox1dic("Location"))
.BackColor = GetColor(listbox1dic("BackColor"))
.Size = GetSize(listbox1dic("Size"))
End With
With MyListBox2
.MultiColumn = True
.ColumnWidth = 180
.DataSource = New BindingSource(listbox2dic, String.Empty)
.Location = GetLoc(listbox2dic("Location"))
.BackColor = GetColor(listbox2dic("BackColor"))
.Size = GetSize(listbox2dic("Size"))
End With
With MyLabel
.Text = labdic("Text")
.BackColor = GetColor(labdic("BackColor"))
.Location = GetLoc(labdic("Location"))
.AutoSize = CBool(labdic("AutoSize"))
.Size = GetSize(labdic("Size"))
End With
Controls.AddRange({MyLabel, MyListBox1, MyListBox2})
End Sub
Function GetColor(s As String) As Color
Return Color.FromArgb(GetInteger(s.Split(","c)(0)), GetInteger(s.Split(","c)(1)), GetInteger(s.Split(","c)(2)), GetInteger(s.Split(","c)(3)))
End Function
Function GetLoc(s As String) As Point
Return New Point(GetInteger(s.Split(","c)(0)), GetInteger(s.Split(","c)(1)))
End Function
Function GetSize(s As String) As Size
Return New Size(GetInteger(s.Split(","c)(0)), GetInteger(s.Split(","c)(0)))
End Function
Function GetInteger(s As String) As Integer
Dim v As Integer = 0
Integer.TryParse(s, v)
Return v
End Function
End Class