以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  PictureBox的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88484)

--  作者:douglas738888
--  发布时间:2016/8/3 16:35:00
--  PictureBox的问题
请教老师,下面这段代码怎样实现 如果“立项”勾选,显示立项提示图片,如果“中标”勾选,显示中标提示图片    PICTUREBOX 是否还需要绑定

将PictureBox控件的BeforeGetImage事件代码设置为:


Dim pbx As WinForm.PictureBox = e.Sender
Dim
r As Row = Tables("项目策划").Current
If r IsNot Nothing Then

    
If r("立项") = True Then
           e.File =
"立项
.png"
        ElseIf 
r("中标") = True Then
            e.File =
"中标
.png"

        Else
            e.File = ""
\'不显示图片
        End
If

    Else

   
    e.File = ""
    End
If
Else
     e.File = ""
\'不显示图片

End If


--  作者:大红袍
--  发布时间:2016/8/3 17:16:00
--  

 直接去写datacolchanged事件

 

If e.DataCol.Name = "立项"  AndAlso e.NewValue = True AndAlso Forms("窗口1").Opened Then

    Forms("窗口1").Controls("PictureBox1").Image = GetImage("立项.png")

End If