Foxtable(狐表)用户栏目专家坐堂 → GroupBox 动态控件


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

主题:GroupBox 动态控件

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


加好友 发短信
等级:九尾狐 帖子:2482 积分:22932 威望:0 精华:0 注册:2011/3/29 17:14:00
GroupBox 动态控件  发帖心情 Post By:2024/3/1 20:40:00 [只看该作者]

Dim GBox As WinForm.GroupBox
Dim Value As String = "新增明细|新增报价|新增楼层|新增区域"
Dim sps() As Char = {"|"}
Dim Names() As String = Value.Split(sps)
Dim s As Integer = 2
Dim t As Integer = 5
For i As Integer = 0 To Names.length - 1
    If i <> 0 Then
        If i Mod 1 = 0 Then
            s = 2
            t = t + 200.5 '高度换算
        Else
            s = s + 261.5 '宽度换算
        End If
    End If 
    Dim nm As String = Names(i)
    GBox = e.Form.CreateControl(nm, ControlTypeEnum.GroupBox)
    GBox.Theme = "(none)" '去掉原来的样式
    '    zcdd.Font = New Font("宋体", 13, FontStyle.Bold)
    GBox.Text = nm
    GBox.name = nm
    GBox.Width = 261
    GBox.Height = 200
    GBox.BackColor = Color.FromARGB(255, 255, 224)
    GBox.ForeColor = Color.FromARGB(169, 169, 169)
    GBox.Left = s + 8
    GBox.Top = t + 2 
    e.Form.AddControl(GBox) 
Next



Dim zcdd As WinForm.Button
'If dr("窗口按键_菜单") < > Nothing Then
'    Dim Value As String = dr("窗口按键_菜单")
'    Dim sps() As Char = {"|"}
'    Dim Names() As String = Value.Split(sps)
'Dim s As Integer = 2
'Dim t As Integer = 5
For i As Integer = 0 To Names.length - 1
    If i <> 0 Then
        If i Mod 3 = 0 Then
            s = 2
            t = t + 50
        Else
            s = s + 66.5
        End If
    End If
    Dim nm As String = Names(i)
    zcdd = e.Form.CreateControl(nm, ControlTypeEnum.Button)
    zcdd.Theme = "(none)" '去掉原来的样式
    zcdd.Font = New Font("宋体", 9, FontStyle.Bold)
    zcdd.Text = nm
    zcdd.name = nm
    zcdd.Width = 65
    zcdd.Height = 49
    zcdd.Left = s + 8
    zcdd.Top = t + 2 
    zcdd.BorderSize = 0
    zcdd.BackMost = False
    '        Forms("主窗_菜单").Controls("菜单页面").Tabpages("功能操作").AddControl(zcdd)   
    '    e.Form.AddControl(zcdd)
    e.Form.Controls("新增明细").AddControl(zcdd)    不能嵌入控件找不到更多的属性
Next

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110738 积分:563610 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/2 9:52:00 [只看该作者]

首先一个窗口里的控件名称不能有重复,GroupBox已经使用同样的名称创建过一轮了

其次按钮的位置已经超出了GroupBox的范围
    zcdd.Left = s + 8
    zcdd.Top = t + 2
    MsgBox(zcdd.Left & "," & zcdd.top)

 回到顶部
帅哥哟,离线,有人找我吗?
yifan3429
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2482 积分:22932 威望:0 精华:0 注册:2011/3/29 17:14:00
  发帖心情 Post By:2024/3/2 13:09:00 [只看该作者]

e.Form.panel.parent.parent.Width = 270 '设定窗口的宽度
e.Form.Text = CurrentTable.Name & "_ 菜单"
'Dim CheckBox1 As WinForm.GroupBox
Dim GBox As WinForm.GroupBox
Dim Value As String = "新增明细|新增报价|新增楼层|新增区域"
Dim sps() As Char = {"|"}
Dim Names() As String = Value.Split(sps)
Dim s As Integer = 2
Dim t As Integer = 5
For i As Integer = 0 To Names.length - 1
    If i <> 0 Then
        If i Mod 1 = 0 Then
            s = 2
            t = t + 200.5 '高度换算
        Else
            s = s + 261.5 '宽度换算
        End If
    End If 
    Dim nm As String = Names(i)
    GBox = e.Form.CreateControl(nm, ControlTypeEnum.GroupBox)
    GBox.Theme = "(none)" '去掉原来的样式
    '    zcdd.Font = New Font("宋体", 13, FontStyle.Bold)
    GBox.Text = nm
    GBox.name = nm
    GBox.Width = 261
    GBox.Height = 200
    GBox.BackColor = Color.Transparent '透明背景色  
    GBox.ForeColor = Color.FromARGB(255, 255, 255) 
    GBox.Left = s + 8
    GBox.Top = t + 2 
    e.Form.AddControl(GBox) 
Next



Dim zcdd As WinForm.Button
'If dr("窗口按键_菜单") < > Nothing Then
Dim Value1 As String = "新增明|新增报|新增楼|新增区"
'    Dim sps() As Char = {"|"}
Dim Names1() As String = Value1.Split(sps)
'Dim s As Integer = 2
'Dim t As Integer = 5
For i As Integer = 0 To Names1.length - 1
    If i <> 0 Then
        If i Mod 3 = 0 Then
            s = 2
            t = t + 50
        Else
            s = s + 66.5
        End If
    End If
    Dim nm As String = Names1(i)
    zcdd = e.Form.CreateControl(nm, ControlTypeEnum.Button)
    zcdd.Theme = "(none)" '去掉原来的样式
    zcdd.Font = New Font("宋体", 9, FontStyle.Bold)
    zcdd.Text = nm
    zcdd.name = nm & 1
    zcdd.Width = 65
    zcdd.Height = 49
    zcdd.Left = s + 8
    zcdd.Top = t + 2 
    zcdd.BorderSize = 0
    zcdd.BackMost = False
    '        Forms("主窗_菜单").Controls("菜单页面").Tabpages("功能操作").AddControl(zcdd)   
    '    e.Form.AddControl(zcdd)
    e.Form.Controls("新增明细").AddControl(zcdd) 
Next

改了也是不行

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110738 积分:563610 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/2 13:50:00 [只看该作者]

按钮的位置已经超出了GroupBox的范围
    zcdd.Left = s + 8
    zcdd.Top = t + 2
    MsgBox(zcdd.Left & "," & zcdd.top)

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110738 积分:563610 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/2 13:53:00 [只看该作者]

处理按钮前把t、s的值还原为初始值。或者改为使用不同的变量计算

 回到顶部