以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]模仿显示OpenQQ的未读消息怎么就出错呢?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=76759)

--  作者:新福星
--  发布时间:2015/11/4 16:36:00
--  [求助]模仿显示OpenQQ的未读消息怎么就出错呢?
\'此段代码用于显示OpenQQ的未读消息
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 Then
    If QQClient.UnreadCount > 0 Then
        txt = "(" & QQClient.UnreadCount & "条)"
    End If
End If
If OpenQQ.Text <> txt Then
    OpenQQ.Text ="OpenQQ" & txt
End If
If OpenQQ.Text > "" And  OpenQQ.Text <> "OpenQQ" 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 jlxx As RibbonMenu.Button
Static LastTime1 As Date
If jlxx Is Nothing Then
    jlxx= ConfigBar.Items("交流信息")
End If
txt = "(" & DataTables("交流信息").SQLCompute("Count(接收人)","已处理=0 And 接收人=\'" & _Userbm & "." & _username & "\'") & "条)"
If jlxx.Text <> txt Then
    jlxx.Text ="交流信息" & txt
End If

If jlxx.Text > "" And  jlxx.Text <> "交流信息" Then
    Dim ntp As timeSpan = Date.Now - LastTime1
    If ntp.TotalSeconds >= 0.5 Then
        LastTime1 = Date.Now
        If jlxx.ForeColor = Color.Red Then
            jlxx.ForeColor = Color.Transparent
        Else
            jlxx.ForeColor = Color.Red
        End If
    End If
End If
这是我模仿的。在配置栏中已经加入了 《交流信息》这个菜单项,出错!

图片点击可在新窗口打开查看此主题相关图片如下:ccc.jpg
图片点击可在新窗口打开查看

问题出在哪呢?谢谢


--  作者:大红袍
--  发布时间:2015/11/4 16:38:00
--  

你的这个菜单 交流信息 不是button 而是 MenuButton

 

代码要这样写

 

Static jlxx As RibbonMenu.MenuButton

 


--  作者:新福星
--  发布时间:2015/11/4 16:45:00
--  
示例为什么可以写成Static OpenQQ As RibbonMenu.Button?
--  作者:新福星
--  发布时间:2015/11/4 16:50:00
--  
弄好了 谢谢