下面的代码,setbounds和text可以通过集合的方式优化吗?
Dim lbl As WinForm.Label
Dim labels() As String = {"label1","label2","label3","label4"}
Dim lab As String
For Each lab In labels
lbl = e.Form.CreateControl(lab,ControlTypeEnum.Label)
lbl.BackColor = Color.Transparent
e.Form.Controls("PictureBox").AddControl(lbl)
Next
e.Form.Controls("label1").SetBounds(62,27,54,19)
e.Form.Controls("label2").SetBounds(62,73,54,19)
e.Form.Controls("label3").SetBounds(160,27,79,19)
e.Form.Controls("label4").SetBounds(160,73,79,19)
e.Form.Controls("label1").Text = "a"
e.Form.Controls("label2").Text = "b"
e.Form.Controls("label3").Text = "c"
e.Form.Controls("abel4").Text = "d"