VB类模块中使用控件的问题

2025-02-23 17:29:51
推荐回答(1个)
回答1:

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