以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- picturebox中动态加入控件,遍历children,没找到控件? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=194758) |
-- 作者:foxrobbie -- 发布时间:2025/1/11 1:55:00 -- picturebox中动态加入控件,遍历children,没找到控件? 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
红色的部分编译没问题,但完全没有执行
|
-- 作者:有点蓝 -- 发布时间:2025/1/11 9:32:00 -- 怎么做【picturebox中动态加入控件】的? |
-- 作者: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
|
-- 作者:有点蓝 -- 发布时间: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 |