以下是引用有点甜在2019/1/21 14:25:00的发言:
参考
Dim sdt As Date = Date.Now
While Date.Now < sdt.AddSeconds(10)
Application.DoEvents
End While
msgbox("10秒后执行")
老师,这个延迟执行没怎么用来,比如我在窗口的afterload事件,红色代码需要等到窗口打开后10s后才执行,应该怎么写?
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.StopRedraw() '停止绘制
lvw.Groups.Clear() '清除原来的分组
lvw.Columns.Clear() '清除原来的列
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.Details '显示模式为详细信息
lvw.TitleSize = New Size(130,80) '设置平铺区域大小
lvw.GridLines = True '显示网格线
Dim cls() As String = {"名称"} '定义列名
Dim wds() As Integer = {100} '定义列宽
For i As Integer = 0 To cls.Length - 1 '增加列
Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
c.Name = cls(i) '指定列名
c.Text = cls(i) '指定标题,这里标题和列名相同
c.Width = wds(i) '指定列宽
Next
For Each zh As String In DataTables("子系统导航").GetValues("分组","","序号") '增加分组
Dim grp As WinForm.ListViewGroup = lvw.Groups.Add()
grp.Name = zh
grp.Text = zh
Next
For Each dr As DataRow In DataTables("子系统导航").DataRows
Dim Key As String = dr("图标")
Dim r As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
lvw.Images.AddImage(Key, Key, Key) '添加代表这个名称的一对图标
r.ImageKey = Key '指定图标键值
r.Group = dr("分组") '指定所属分组
r.Tag = dr
For Each cl As String In cls '逐列取值
r(cl) = dr(cl)
Next
Next
lvw.ResumeRedraw() '恢复绘制
lvw.View = ViewMode.LargeIcon '显示模式切换为大图标
'延迟10s执行下列代码
If _Fuzeren = Nothing OrElse _Fuzerendianhua = Nothing OrElse _Dengjiren = Nothing OrElse _Dengjirendianhua = Nothing Then
MessageBox.Show("第一次登录,请先完善项目基本信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Forms("项目信息").Open()
End If
[此贴子已经被作者于2019/3/27 21:02:33编辑过]