以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  BeforeGetImage及时变换的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=86766)

--  作者:douglas738888
--  发布时间:2016/6/25 12:49:00
--  BeforeGetImage及时变换的问题
请教老师,以下代码写在BeforeGetImage,功能已经实现,但是,需要关闭一次窗口才能改变需要转换的图片,不能及时转换图片

想把以下代码写到TimerTick,但是报错,File 不是....的成员,请教老师怎样实现及时根据条件转换显示图片。

Dim pbx As WinForm.PictureBox = e.Sender
Dim lbl As WinForm.Label = e.Form.Controls("Label3")
If lbl IsNot Nothing Then
   Dim Count As Double
   Count = DataTables("任务分派").Compute("Count(项目编号)","任务人员 like  \'%" & _UserName & "%\' and (任务已读 not Like \'%" & _UserName & "%\' or 任务已读 is null)")
   If Count = 0 Then
        e.File = "Gnome-Colors-Emblem-Green.ico" \'显示图片
    ElseIf Count >= 1 Then 
        e.File = "Gnome-Colors-Emblem-Desktop-Red-32.png" \'显示图片
    End If
End If

--  作者:Hyphen
--  发布时间:2016/6/25 14:58:00
--  
需要绑定列,然后表Currentchanged的时候才会触发事件

放到计时器代码改成

Dim pbx As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim lbl As WinForm.Label = e.Form.Controls("Label3")
If lbl IsNot Nothing Then
   Dim Count As Double
   Count = DataTables("任务分派").Compute("Count(项目编号)","任务人员 like  \'%" & _UserName & "%\' and (任务已读 not Like \'%" & _UserName & "%\' or 任务已读 is null)")
   If Count = 0 Then
        pbx.ImageFile = "Gnome-Colors-Emblem-Green.ico" \'显示图片
    ElseIf Count >= 1 Then 
        pbx.ImageFile= "Gnome-Colors-Emblem-Desktop-Red-32.png" \'显示图片
    End If
End If