Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:picturebox中动态加入控件,遍历children,没找到控件?

1楼
foxrobbie 发表于:2025/1/11 1:55:00
        Dim p_country As WinForm.picturebox = e.Form.Controls("Pb_国家")
        Dim countrylist As String = ""
        For Each c As WinForm.PictureBox In p_country.children
            countrylist = countrylist & "," & c.Name
        Next
红色的部分编译没问题,但完全没有执行
2楼
有点蓝 发表于:2025/1/11 9:32:00
怎么做【picturebox中动态加入控件】的?
3楼
foxrobbie 发表于:2025/1/11 12:19:00
Dim fm As WinForm.Form = forms(args(0)) '窗口名
Dim PName As String = args(1) 'picturebox名

Dim pa As WinForm.PictureBox= fm.Controls(PName)
Dim pbx As WinForm.PictureBox
For Each p As String In ps
    pbx = fm.CreateControl(p, ControlTypeEnum.PictureBox)
    pa.AddControl(pbx)
    pbx.ToolTip = p
    pbx.Width = 53
    pbx.Height = 39
    pbx.Left = x
    pbx.Top = y
    If p <> "" Then
    pbx.ImageFile = p & ".png"
    Else
    pbx.ImageFile =  "问号.png"
    End If
    pbx.SizeMode = ImageSizeMode.Zoom    
     x = x + 60
    If x+60 > pa.Width Then
        x = 2
        y = y + 42
    End If
Next
4楼
有点蓝 发表于:2025/1/11 13:16:00
应该是bug,我反馈一下

临时先换种用法

Dim p_country As WinForm.picturebox = e.Form.Controls("Pb_国家")

For Each c As Object In p_country.BaseControl.Controls(0).Controls
    msgbox(c.Name)
Next
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03125 s, 2 queries.