VB6.0中,如何动态添加控件至指定的PictureBox控件中?
VB6.0中,如何动态添加控件至指定的PictureBox控件中?顺便问问,当PictureBox控件中添加的控件达到一个量的时候,如何让PictureBox控件出现滚动条的东西,以便动态显示这些控件?
Option Explicit Dim ctlNum As Integer Private Sub Form_Load() ctlNum = 1 End Sub Private Sub Option1_Click(Index As Integer) ctlNum = Index End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim i As Integer If Button = 1 Then Select Case ctlNum Case 0 i = Label1.UBound + 1 Load Label1(i) Label1(i).Left = X Label1(i).Top = Y Label1(i).Height = Label1(0).Height Label1(i).Width = Label1(0).Width Label1(i).Visible = True Set Label1(i).Container = Picture1 Case 1 i = Command1.UBound + 1 Load Command1(i) Command1(i).Left = X Command1(i).Top = Y Command1(i).Height = Command1(0).Height Command1(i).Width = Command1(0).Width Command1(i).Visible = True Set Command1(i).Container = Picture1 Case 2 i = Text1.UBound + 1 Load Text1(i) Text1(i).Left = X Text1(i).Top = Y Text1(i).Height = Text1(0).Height Text1(i).Width = Text1(0).Width Text1(i).Visible = True Set Text1(i).Container = Picture1 End Select End If End Sub Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single) Source.Move X, Y End Sub