精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● VB和Basic>>〓〓..各种开发技巧..〓〓>>窗体显示系统>>vb中动态生成控件的两种方法

主题:vb中动态生成控件的两种方法
发信人: ajiannet()
整理人: winsy(2003-03-05 16:36:03), 站内信件
1.使用控件数组,必须在设计时添加一个index为0的控件,程序中动态添加,例

  Load Command1(1)
  Command1(1).Left=Command1(0).Left+Command1(0).Width
  Command1(1).Visible=True  
2.使用Controls集合的Add方法,例:
  Dim a As CommandButton
  Set a = Controls.Add("VB.CommandButton", "a2")
  a.Left = 0
  a.Top = 0
  a.Caption = "a2"
  a.Visible = True

--
vb一网打尽隆重开张:ajianvb.126.com
希望大家能支持我的vb论坛:vbbbs.126.com ,谢谢!

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 61.156.92.253]

[关闭][返回]