请教VB高手一个新建控件的问题

来源:百度知道 编辑:UC知道 时间:2024/07/07 07:45:26
比如建个text1.text,在控件里一拖一拉就行了。但如在程序里怎么建呢?

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI
X As Long
Y As Long
End Type

Private Sub Label1_Click(Index As Integer)
Text4.Text = 3
End Sub

Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 And Index > 0 Then
Unload Label1(Index) '删除label控件
End If
End Sub

Private Sub Text1_Click(Index As Integer)
Text4.Text = 2
End Sub

Private Sub Text1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 And Index > 0 Then
Unload Text1(Index) '删除text控件
End If
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim mouse As POINTAPI
GetCursorPos mouse