Foxtable(狐表)用户栏目专家坐堂 → 如何动态增加groubox并且控制其大小


  共有2185人关注过本帖树形打印复制链接

主题:如何动态增加groubox并且控制其大小

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/5/17 16:22:00 [显示全部帖子]

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

 回到顶部