以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  求助:选项排序混乱,可能if语句问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=151844)

--  作者:18801459487
--  发布时间:2020/7/5 18:20:00
--  求助:选项排序混乱,可能if语句问题
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:单选答题界面.rar

附件是添加的程序,语句写好了,
1、点击上一题 下一题按钮就能排列
题身有一行或者两行的时候,可以达到自动排列效果
但是如果题身是三行的话,选项排序就出问题啦
自以为逻辑没问题,但总是出问题,很是困惑,心想是不是if语句的串联出现问题啦
求大神指点,问题出在哪里

2、还有就是,希望窗口打开的时候,选项能够自动排序,把代码放到窗口afterload不行,
但是放到sizechanged,窗口放大就能自动排列啦
这个问题出在哪里呢,我应该把代码放到哪里


图片点击可在新窗口打开查看此主题相关图片如下:排序混乱.png
图片点击可在新窗口打开查看


代码如下

\' 设计格式
If  len(trim((e.Form.Controls("Label21").text))) = 0    Then     \'如果题身3等于0
    If len(trim((e.Form.Controls("Label20").text))) = 0    Then   \'如果题身2也等于0,只有一行
        If len(e.Form.Controls("Label7").text) <10 And len(e.Form.Controls("Label8").text) <10 And len(e.Form.Controls("Label9").text) <10And len(e.Form.Controls("Label10").text) <10 Then
            e.Form.Controls("Label2").SetBounds(67,100,51,38) \' 四个选项排列一行
            e.Form.Controls("Label7").SetBounds(113,100,51,38)
            e.Form.Controls("Label3").SetBounds(267,100,51,38)
            e.Form.Controls("Label8").SetBounds(313,100,51,38)
            e.Form.Controls("Label4").SetBounds(467,100,51,38)
            e.Form.Controls("Label9").SetBounds(513,100,51,38)
            e.Form.Controls("Label5").SetBounds(667,100,51,38)
            e.Form.Controls("Label10").SetBounds(713,100,51,38)            
        ElseIf   len(e.Form.Controls("Label7").text) <20 And len(e.Form.Controls("Label8").text) <20 And len(e.Form.Controls("Label9").text) <20 And len(e.Form.Controls("Label10").text) <20   Then
            e.Form.Controls("Label2").SetBounds(67,100,51,38)   \'四个选项排2行,一行2个
            e.Form.Controls("Label7").SetBounds(113,100,51,38)
            e.Form.Controls("Label3").SetBounds( 400,100,51,38)
            e.Form.Controls("Label8").SetBounds(450,100,51,38)
            e.Form.Controls("Label4").SetBounds(67,140,51,38)
            e.Form.Controls("Label9").SetBounds(113,140,51,38)
            e.Form.Controls("Label5").SetBounds(400,140,51,38)
            e.Form.Controls("Label10").SetBounds(450,140,51,38)
        Else \'四个选项排列四行
            e.Form.Controls("Label2").SetBounds(67,100,51,38)
            e.Form.Controls("Label3").SetBounds(67,140,51,38)
            e.Form.Controls("Label4").SetBounds(67,180,51,38)
            e.Form.Controls("Label5").SetBounds(67,220,51,38)
            e.Form.Controls("Label7").SetBounds(113,100,51,38)
            e.Form.Controls("Label8").SetBounds(113,140,51,38)
            e.Form.Controls("Label9").SetBounds(113,180,51,38)
            e.Form.Controls("Label10").SetBounds(113,220,51,38)
        End If

    ElseIf   len(trim((e.Form.Controls("Label20").text))) > 0    Then    \'题身2大于0的时候,有两行
        If len(trim((e.Form.Controls("Label7").text))) <10 And len(trim((e.Form.Controls("Label8").text))) <10 And len(trim((e.Form.Controls("Label9").text))) <10 And len(trim((e.Form.Controls("Label10").text))) <10 Then
            e.Form.Controls("Label2").SetBounds(67,140,51,38)   \' 四个选项排1行
            e.Form.Controls("Label7").SetBounds(113,140,51,38)
            e.Form.Controls("Label3").SetBounds(267,140,51,38)
            e.Form.Controls("Label8").SetBounds(313,140,51,38)
            e.Form.Controls("Label4").SetBounds(467,140,51,38)
            e.Form.Controls("Label9").SetBounds(513,140,51,38)
            e.Form.Controls("Label5").SetBounds(667,140,51,38)
            e.Form.Controls("Label10").SetBounds(713,140,51,38)            
        ElseIf  10<len(trim((e.Form.Controls("Label7").text))) <20 And 10<len(trim((e.Form.Controls("Label8").text))) <20 And 10<len(trim((e.Form.Controls("Label9").text))) <20 And 10<len(trim((e.Form.Controls("Label10").text))) <20   Then
            e.Form.Controls("Label2").SetBounds(67,140,51,38)   \'四个选项2行,一行2个
            e.Form.Controls("Label7").SetBounds(113,140,51,38)
            e.Form.Controls("Label3").SetBounds(467,140,51,38)
            e.Form.Controls("Label8").SetBounds(513,140,51,38)
            e.Form.Controls("Label4").SetBounds(67,180,51,38)
            e.Form.Controls("Label9").SetBounds(113,180,51,38)
            e.Form.Controls("Label5").SetBounds(467,180,51,38)
            e.Form.Controls("Label10").SetBounds(513,180,51,38)
        Else
            e.Form.Controls("Label2").SetBounds(67,140,51,38)      \'四个选项四行
            e.Form.Controls("Label3").SetBounds(67,180,51,38)
            e.Form.Controls("Label4").SetBounds(67,220,51,38)
            e.Form.Controls("Label5").SetBounds(67,260,51,38)
            e.Form.Controls("Label7").SetBounds(113,140,51,38)
            e.Form.Controls("Label8").SetBounds(113,180,51,38)
            e.Form.Controls("Label9").SetBounds(113,220,51,38)
            e.Form.Controls("Label10").SetBounds(113,260,51,38)
        End If
    End If
     If len(trim((e.Form.Controls("Label21").text))) > 0 Then  \'当题身3大于0的时候,三行
        If len(trim((e.Form.Controls("Label7").text))) <10 And len(trim((e.Form.Controls("Label8").text))) <10 And len(trim((e.Form.Controls("Label9").text))) <10 And len(trim((e.Form.Controls("Label10").text))) <10 Then
            e.Form.Controls("Label2").SetBounds(67,180,51,38)   \' 四个选项排1行
            e.Form.Controls("Label7").SetBounds(113,180,51,38)
            e.Form.Controls("Label3").SetBounds(267,180,51,38)
            e.Form.Controls("Label8").SetBounds(313,180,51,38)
            e.Form.Controls("Label4").SetBounds(467,180,51,38)
            e.Form.Controls("Label9").SetBounds(513,180,51,38)
            e.Form.Controls("Label5").SetBounds(667,180,51,38)
            e.Form.Controls("Label10").SetBounds(713,180,51,38)
        ElseIf  len(trim((e.Form.Controls("Label7").text))) <20 And len(trim((e.Form.Controls("Label8").text))) <20 And len(trim((e.Form.Controls("Label9").text))) <20 And len(trim((e.Form.Controls("Label10").text))) <20   Then
            e.Form.Controls("Label2").SetBounds(67,180,51,38)   \'四个选项2行,一行2个
            e.Form.Controls("Label7").SetBounds(113,180,51,38)
            e.Form.Controls("Label3").SetBounds(467,180,51,38)
            e.Form.Controls("Label8").SetBounds(513,180,51,38)
            e.Form.Controls("Label4").SetBounds(67,220,51,38)
            e.Form.Controls("Label9").SetBounds(113,220,51,38)
            e.Form.Controls("Label5").SetBounds(467,220,51,38)
            e.Form.Controls("Label10").SetBounds(513,220,51,38)
        Else
            e.Form.Controls("Label2").SetBounds(67,180,51,38)      \'四个选项四行
            e.Form.Controls("Label3").SetBounds(67,220,51,38)
            e.Form.Controls("Label4").SetBounds(67,260,51,38)
            e.Form.Controls("Label5").SetBounds(67,300,51,38)
            e.Form.Controls("Label7").SetBounds(113,180,51,38)
            e.Form.Controls("Label8").SetBounds(113,2200,51,38)
            e.Form.Controls("Label9").SetBounds(113,260,51,38)
            e.Form.Controls("Label10").SetBounds(113,300,51,38)
        End If
    End If   
End If
[此贴子已经被作者于2020/7/5 18:27:13编辑过]

--  作者:有点蓝
--  发布时间:2020/7/5 21:28:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:单选答题界面.zip


--  作者:18801459487
--  发布时间:2020/7/5 22:37:00
--  
感谢大神,周末还在帮忙,简直太给力啦
建议你们可以开通个打赏啥的,愿意略表心意

纯小白,目前网页玩的还不是很熟练,如果有这功能,请告知

再次感谢,手动点赞