Foxtable(狐表)用户栏目专家坐堂 → [求助]循环增加控件


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

主题:[求助]循环增加控件

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


加好友 发短信
等级:超级版主 帖子:521 积分:4910 威望:0 精华:7 注册:2008/9/2 22:22:00
  发帖心情 Post By:2015/4/13 21:56:00 [显示全部帖子]

这样?
Dim cz As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim jjk As WinForm.TextBox = e.Form.Controls("TextBox6")
Dim fs As WinForm.ComboBox = e.Form.Controls("ComboBox2")

If cz.text = "" Then
    MessageBox.show("请先选择材质","提示")
Else
    If fs.text = "横裁" Then
        Dim maxc As Integer
        Dim maxk As Integer
        maxc = DataTables("规格需求").Compute("max(长)","材质 ='" & cz.text & "' and 剩余欠量 > 0 and 不套裁 = false")
        maxk = DataTables("规格需求").Compute("max(宽)","长 = "& maxc &" And 剩余欠量 > 0 And 不套裁 = false")
        Dim dc As DataRow = DataTables("规格需求").find("长 = "& maxc &" And 宽 = "& maxk &"")

        Dim gg1 As String = maxc & "*" & maxk
        Dim x1 As Integer = maxc / 3.5
        Dim x2 As Integer = maxk / 3.5
        Dim wzx As Integer = 5 + (i - 1) * (maxc + 1)

        Dim xq As Integer = dc("剩余欠量")
        Dim hengchu1 As Integer = Int(1200 / (maxk + 4))
        Dim Ary() As Integer = {xq,hengchu1}
        Array.Sort(ary)
        Dim sas As Integer = ary(0)

            
        Dim Panel1 As WinForm.Panel
        Dim lbl As WinForm.Label
    
        For i As Integer = 1 To sas            
            Panel1 = e.Form.CreateControl("Panel" & i, ControlTypeEnum.Panel)
            Panel1.SetBounds(wzx, 5, x2, x1)
            e.Form.Controls("SplitContainer1").Panel2.AddControl(Panel1)
            e.Form.Controls("Panel1").BackColor = Color.Orangered
            
            lbl = e.Form.CreateControl("Label" & i, ControlTypeEnum.Label)
            lbl.Text = gg1
            lbl.Left = x2 / 2 - 30
            lbl.Top = x1 / 2 - 15
            e.Form.Controls("Panel1").AddControl(lbl)
            Dim nd As DataRow = DataTables("临时").addnew()
            nd("规格编号") = dc("规格编号")
            nd("数量") = 1
            'Dim syh1 As Integer = 1
        Next
    End If
End If

 回到顶部