根据表"操作按钮名"列动态创建控件,想在计时器中交替显示颜色,下面的代码效率低,程序有卡死现象,老师请问怎么提高运行效率,谢谢!
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