参考,自行扩充
Dim dt As DataTable = DataTables("员工信息表")
Dim pcount As Integer = 1
For Each sl As String In dt.GetValues("势力")
Dim pnl As WinForm.panel
pnl = e.Form.CreateControl("lable1", ControlTypeEnum.panel)
pnl.Left = 100
pnl.Top = 100 * pcount
pnl.width = 500
pnl.height = 100
e.Form.AddControl(pnl)
pcount += 1
Dim lcount As Integer = 0
For Each dr As DataRow In dt.Select("势力 = '" & sl & "'")
Dim lbl As WinForm.label
lbl = e.Form.CreateControl("lable" & dr("姓名"), ControlTypeEnum.Label)
lbl.Text = dr("姓名")
lbl.Left = 10 + lcount*100
lbl.Top = 10
If dr("类型") = "武将" Then
lbl.backcolor = Color.red
ElseIf dr("类型") = "文臣" Then
lbl.backcolor = Color.yellow
End If
lcount += 1
pnl.AddControl(lbl)
Next
Next