且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

vb 类 动态 添加 控件

更新时间:2022-08-13 09:45:56

引用:http://zhidao.baidu.com/question/66115499.html

clsTask
____________________________
Private lbl As Label
Private frm As Form


Public Property Let Owner(ByVal vNewValue As Form)
Set frm = vNewValue
End Property

Public Sub AddPanel(ByVal strCaptiop As String)
Set lbl = frm.Controls.Add("VB.Label", "lbl1")
lbl.Move 1000, 1000, 1000, 1000
lbl.Caption = strCaptiop
lbl.Visible = True
End Sub

form
__________
Private Sub Form_Load()

Dim a As New clsTask
a.Owner = Me
a.AddPanel ("1243")
End Sub