以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求助 动态添加列的图片  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=100404)

--  作者:jackyfashion
--  发布时间:2017/5/10 23:20:00
--  求助 动态添加列的图片
您 好! 老师:
是否可以用循环动态添加列图片?
谢谢!
下例只能绑定一个图像,怎样写代码才能动态绑定当前表对应行的图像? 
多谢老师指点!!!
For  i As Integer=0 To Tables("qrymyf").rows.count-1
    Dim txt As WinForm.PictureBox
    txt = e.Form.CreateControl("Pic_" & i, ControlTypeEnum.PictureBox)
    txt.BackColor = Color.Black
    txt.SizeMode = ImageSizeMode.Zoom
txt.BorderStyle = BorderStyle.Fixed3D
    txt.Width = 200
    txt.Height = 250
    txt.Left = 220*i + 50
    txt.Top = 35
    e.Form.Controls("Panel1").AddControl(txt)
     txt.BindingField = Tables("qrymyf").Rows(i)("ltsu")      
     txt.ImageFile = "D:\\设计图样\\1704068.jpg"
Next
我是行外人,跪求示教!谢谢!
[此贴子已经被作者于2017/5/10 23:26:51编辑过]

--  作者:有点色
--  发布时间:2017/5/11 0:37:00
--  
For  i As Integer=0 To Tables("qrymyf").rows.count-1
    Dim txt As WinForm.PictureBox
    txt = e.Form.CreateControl("Pic_" & i, ControlTypeEnum.PictureBox)
    txt.BackColor = Color.Black
    txt.SizeMode = ImageSizeMode.Zoom
    txt.BorderStyle = BorderStyle.Fixed3D
    txt.Width = 200
    txt.Height = 250
    txt.Left = 220*i + 50
    txt.Top = 35
    e.Form.Controls("Panel1").AddControl(txt)
    txt.image = GetImage(ProjectPath & "attachments/" & Tables("qrymyf").rows(i)("ltsu"))
Next

--  作者:jackyfashion
--  发布时间:2017/5/11 20:36:00
--  
谢谢老师!
谢谢!谢谢!谢谢老师!!!
终于可以了
[此贴子已经被作者于2017/5/11 20:46:58编辑过]

--  作者:jackyfashion
--  发布时间:2017/5/21 20:45:00
--  

老师:您好!

我把上边的代码拷到Button,

当我筛选的表,行数减少,但PictureBox,个数不少.

原来表有四行,动态增加四个图片框

我筛选表少着两行,图片框还是四个

请教老师加什么代码可以重新刷新?谢谢!!

 


--  作者:有点色
--  发布时间:2017/5/22 8:32:00
--  

筛选之后执行代码

 

e.Form.Controls("Panel1").children.clear
For  i As Integer=0 To Tables("qrymyf").rows.count-1
    Dim txt As WinForm.PictureBox
    txt = e.Form.CreateControl("Pic_" & i, ControlTypeEnum.PictureBox)
    txt.BackColor = Color.Black
    txt.SizeMode = ImageSizeMode.Zoom
    txt.BorderStyle = BorderStyle.Fixed3D
    txt.Width = 200
    txt.Height = 250
    txt.Left = 220*i + 50
    txt.Top = 35
    e.Form.Controls("Panel1").AddControl(txt)
    txt.image = GetImage(ProjectPath & "attachments/" & Tables("qrymyf").rows(i)("ltsu"))
Next


--  作者:jackyfashion
--  发布时间:2017/5/22 20:11:00
--  

谢谢老师!


--  作者:jackyfashion
--  发布时间:2017/5/22 21:32:00
--  求助 动态控件

老师:您好!

我加了代码后,不起作用,是不是写个代码把控件先清除再重新加载控件?请老师帮忙指教!!!,谢谢!!!


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


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

打开窗口是5 行,所以5个控件,筛选之后是3行,还是5个控件,头三个是对的,后边两个消不了,

请老师指教!!!谢谢!!!

[此贴子已经被作者于2017/5/22 22:02:50编辑过]

--  作者:有点蓝
--  发布时间:2017/5/22 22:22:00
--  
e.Form.Controls("Panel1").children.clear
改为
e.Form.Controls("Panel1").basecontrol.Controls.clear
--  作者:jackyfashion
--  发布时间:2017/5/22 22:24:00
--  

谢谢老师!!!

可以罗