在VB中如何动态创建控件
PrivateSubCommand1_Click()要求如下:·创建一个Label控件·Caption=Label1·Top=200·Width=7000·Visible...
Private Sub Command1_Click()
要求如下:
·创建一个Label控件
·Caption = Label1
·Top = 200
·Width = 7000
·Visible = True 展开
要求如下:
·创建一个Label控件
·Caption = Label1
·Top = 200
·Width = 7000
·Visible = True 展开
2个回答
展开全部
Public IsExists As Boolean
Private Sub Command1_Click()
Dim lbl As Label
If IsExists = False Then
Set lbl = Me.Controls.Add("VB.Label", "lbl")
IsExists = True
lbl.Caption = "Label1"
lbl.Top = 200
lbl.Width = 7000
lbl.Visible = True
End If
End Sub
Private Sub Command1_Click()
Dim lbl As Label
If IsExists = False Then
Set lbl = Me.Controls.Add("VB.Label", "lbl")
IsExists = True
lbl.Caption = "Label1"
lbl.Top = 200
lbl.Width = 7000
lbl.Visible = True
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询