vb如何单击按钮增加按钮

来源:百度知道 编辑:UC知道 时间:2024/06/23 14:42:03
假设我有一个按钮1,如何单击一次1自动生成一个按钮2,再单击一次生成另一个按钮3,但是按钮2还在,以此类推,单击一次生成一个新的按钮,没有最大按钮数限制。谢谢~

command1_click()
call command2_click
end sub

使用控件数组,把command1的index设置为0

Dim j As Long, lf As Long, tp As Long

Private Sub Command1_Click(Index As Integer)

j = j + 1

Load Command1(j)

lf = 10

tp = tp + 150

Command1(j).Left = lf

Command1(j).Top = tp

Command1(j).Visible = True

End Sub

Private Sub Command1_Click(Index As Integer)
Static i
i = i + 1
Load Comman