老师好,我想把动态生成的每个面板设置不同的颜色,谢谢老师。
Dim left1 As Integer = 50
Dim txt3 As WinForm.Panel
For i As Integer = 1 To 7
txt3 = e.Form.CreateControl("数据" & i, ControlTypeEnum.Panel)
txt3.Left = left1
txt3.Top = 180
txt3.width = 80
txt3.height = 150
left1 += 120
txt3.left = 30 + 112 * (i-1)
'txt3.BorderStyle = BorderStyle.Fixed3D
txt3.Anchor = Windows.Forms.AnchorStyles.Top Or Windows.Forms.AnchorStyles.Bottom
e.Form.Controls("面板").AddControl(txt3)
Next
http://www.foxtable.com/webhelp/topics/0720.htm
Dim txt3 As WinForm.Panel
dim yse() as color = {color.red,coloe.blue,.................}
For i As Integer = 1 To 7
txt3 = e.Form.CreateControl("数据" & i, ControlTypeEnum.Panel)
txt3.BackColor = yse(i-1)