Dim tab1 As WinForm.TabControl=e.Form.Controls("TabControl1") Dim gb As WinForm.GroupBox e.Form.Controls("pan1").basecontrol.controls.clear Dim ay As Integer = 10 For Each na As String In DataTables("表B").GetValues("类型","启用=1") gb=e.Form.CreateControl(na, ControlTypeEnum.GroupBox) gb.text=na e.Form.Controls("pan1").AddControl(gb) Dim i As Integer = 0 Dim x As Integer = 10 Dim y As Integer = 10 For Each dr As DataRow In DataTables("表B").Select("启用=1 and 类型 = '" & na & "'") Dim btn = e.Form.CreateControl(dr("名称"), ControlTypeEnum.CheckBox) btn.Text = dr("名称") btn.Left = x + i*120 btn.Top = y i = i+1 If i Mod 2 = 0 Then i = 0 x = 10 y += 45 End If gb.AddControl(btn) Next gb.width = e.Form.controls("pan1").width gb.height = y + 45 gb.left = 0 gb.Top = ay msgbox(ay) ay = ay + y + 45 Next
|