以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  怎么提高计时器效率  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=149284)

--  作者:飞云
--  发布时间:2020/4/28 9:25:00
--  怎么提高计时器效率
根据表"操作按钮名"列动态创建控件,想在计时器中交替显示颜色,下面的代码效率低,程序有卡死现象,老师请问怎么提高运行效率,谢谢!

For Each k As WinForm.Control In e.Form.Controls
    For Each dr As Row In Tables("table2").Rows
        If dr.IsNull("操作按钮名") = False Then \'如果作按钮名不为空
            Dim nms() As String = dr("操作按钮名").Split(",") 
            For Each nm As String In nms \'遍历
                For Each c As WinForm.Control In e.Form.Controls
                    If Typeof c Is WinForm.Line Then \'判断控件
                        Dim t As WinForm.Line= c \'使用特定类型的变量引用控件
                        If t.Name=nm Then
                            If dr.Checked Then
                                If t.LineColor=Color.Red Then
                                    If dr.isnull("基本颜色") Then
                                        t.LineColor=Color.White
                                    Else
                                        t.LineColor=Color.FromARGB(dr("基本颜色"))\'线条颜色
                                    End If
                                Else
                                    t.LineColor=Color.Red
                                End If
                            End If
                        End If
                    End If
                Next
            Next
        End If
    Next
Next

--  作者:有点蓝
--  发布时间:2020/4/28 9:51:00
--  
没看懂。做个例子发上来看看