如何让用函数动态生成的控件包含在父控件中,而不是窗体中

解决方案 »

  1.   

    '在窗体上加一个CommandButton和一个Frame
    Private Sub Command1_Click()
    Dim l As VB.Label
    Set l = Controls.Add("VB.Label", "Label1", Frame1)
    With l
        .Left = 100
        .Top = 200
        .Height = 300
        .Width = 1000
        .Caption = "ss"
        .Visible = True
    End With
    End Sub
      

  2.   

    如果换为PIC框,并且PIC拥有一个INDEX值
      

  3.   

    Private Sub Command1_Click()
    Dim l As VB.Label
    Set l = Controls.Add("VB.Label", "Label1", Picture1(1))
                                              '~~~~~~~~~~~~改这不完了吗?
    With l
        .Left = 100
        .Top = 200
        .Height = 300
        .Width = 1000
        .Caption = "ss"
        .Visible = True
    End With
    End Sub