以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  systemidle事件代码请教  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=81300)

--  作者:ljh29206
--  发布时间:2016/2/24 9:55:00
--  systemidle事件代码请教

\'QQ闪烁
Static OpenQQ As RibbonMenu.Button
Static LastTime As Date
If OpenQQ Is Nothing Then
    OpenQQ = ConfigBar.Items("OpenQQ")
End If
Dim txt As String
If QQClient.Ready
    If QQClient.UnreadCount > 0 Then
        txt = "(" & QQClient.UnreadCount & "条)"
    End If
End If
If OpenQQ.Text <> txt Then
    OpenQQ.Text = txt
End If
If OpenQQ.Text > "" Then
    Dim ntp As timeSpan = Date.Now - LastTime
    If ntp.TotalSeconds >= 0.5 Then
        LastTime = Date.Now
        If OpenQQ.ForeColor = Color.Red Then
            OpenQQ.ForeColor = Color.Transparent
        Else
            OpenQQ.ForeColor = Color.Red
        End If
    End If
End If

\'待办事件闪烁
Static workwait As RibbonMenu.Button
Static LastTime1 As Date
If workwait Is Nothing Then
    workwait = ConfigBar.Items("待办事宜")
End If
Dim txt1 As String
Dim drsp As List(Of DataRow)
drsp = DataTables("信息查阅情况").Select("状态 = 0 and 人名  = \'" & Vars("user") & "\' and 会议开始时间 > #" & Date.now & "#")

    If drsp.Count > 0 Then
        txt1 =   "(" & drsp.Count & "件)"
    Else
    txt1= ""
    End If

If workwait.Text <> txt1 Then
    workwait.Text = txt1
End If
If drsp.Count > 0 Then
    Dim ntp As timeSpan = Date.Now - LastTime1
    If ntp.TotalSeconds >= 0.5 Then
        LastTime1 = Date.Now
        If workwait.ForeColor = Color.Red Then
            workwait.ForeColor = Color.Transparent
        Else
            workwait.ForeColor = Color.Red
        End If
    End If
End If

Static biaoqian As RibbonMenu.Label
If biaoqian  Is Nothing Then
biaoqian = ConfigBar.Items("标签1")   ‘用于固定配置栏的长度
End If
If txt.Contains("(") AndAlso txt1.Contains("(") Then
biaoqian.text = "                               "
End If
If txt.Contains("(") AndAlso txt1.Contains("(") = False Then
biaoqian.text = "                                     "
End If
If txt.Contains("(") = False AndAlso txt1.Contains("(") Then
biaoqian.text = "                                     "
End If
If txt.Contains("(") = False AndAlso txt1.Contains("(") = False Then
biaoqian.text = "                                             "
End If

systemidle事件里面加了红色的代码  就会报错,提示 未应用到实例中

--  作者:大红袍
--  发布时间:2016/2/24 9:58:00
--  

不应该报错的,你赋初值看看

 

Dim txt As String = ""