+ -
当前位置:首页 → 问答吧 → 请问控件中如何加载控件

请问控件中如何加载控件

时间:2011-12-11

来源:互联网

我有一个窗体 窗体中有 Picturebox控件 Picturebox中用 command按钮


我用
For i = 1 To 9
  Load Picturebox(i)
  Picturebox(i).ZOrder (0)
  Picturebox(i).Visible = True
  Picturebox(i).Left = Picturebox(i - 1).Left + Picturebox(i).Width + 20
Next i

可以动态加载Picturebox控件
但是 我想做的是 在Picturebox控件中还要在加控件要怎么弄呢?


For i = 1 To 9
  Load Picturebox(i)
  Picturebox(i).ZOrder (0)
  Picturebox(i).Visible = True
  Picturebox(i).Left = Picturebox(i - 1).Left + Picturebox(i).Width + 20

  for m=1 to 5
  Load command(m)
  command(i).ZOrder (0)
  command(i).Visible = True
  command(i).Left = command(i - 1).Left + command(i).Width + 20
  next m
Next i
控件在控件中

作者: woodepany   发布时间: 2011-12-11

for m=1 to 5
  Load command(m)
set command(m).container=picture1
  command(i).ZOrder (0)
  command(i).Visible = True
  command(i).Left = command(i - 1).Left + command(i).Width + 20
  
 next m

作者: worldy   发布时间: 2011-12-11

引用 1 楼 worldy 的回复:
for m=1 to 5
Load command(m)
set command(m).container=picture1
command(i).ZOrder (0)
command(i).Visible = True
command(i).Left = command(i - 1).Left + command(i).Width + 20

next m
……


大哥 显示 对象已经加载过了

作者: woodepany   发布时间: 2011-12-12

VB code
For i = 1 To 9
  Load PictureBoxtt(i)
  PictureBoxtt(i).ZOrder (0)
  PictureBoxtt(i).Visible = True
  PictureBoxtt(i).Left = PictureBoxtt(i - 1).Left + PictureBoxtt(i).Width + 20

        For m = 1 To 5
            Load Command(i)
            Set Command(m).Container = PictureBoxtt(i)
            Command(m).ZOrder (0)
            Command(m).Visible = True
            Command(m).Left = Command(m - 1).Left + Command(m).Width + 20
         Next m


Next i


作者: woodepany   发布时间: 2011-12-12