追加一句,是达到手动用鼠标在工具箱上把list控件拖到sstab控件上的效果

解决方案 »

  1.   

    Private Sub Form_Load()
       Set list.Container = SSTab1
       list.Left = 0
       list.Top = 0
    End Sub
      

  2.   

    补充一下:
    Private IsMove As Boolean
    Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
       IsMove = True
    End Sub
    Private Sub SSTab1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If IsMove Then
       Set List1.Container = SSTab1
       List1.Left = X
       List1.Top = Y
       IsMove = False
    End If
    End Sub
      

  3.   

    wqb(啊喂) :
    我已经可以把list控件移到sstab 中了,但我还想把list控件从sstab的tab(0)移到tab(2)上该怎样做啊先谢谢你了!
      

  4.   

    add sstab1,command1,list1
    click command1, then you can reset list1 by left button of mouse
    Dim Moveenable As Boolean
    Dim preX As Single, preY As Single
    Private Sub command1_Click()
        Form1.MousePointer = 2
        Moveenable = True
    End SubPrivate Sub Form_Load()
        Shape1.Shape = 0
        Shape1.BorderStyle = 3
        Shape1.Visible = False
    End SubPrivate Sub SSTab1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Moveenable And Button = 1 Then
            Set Shape1.Container = SSTab1
            Shape1.Visible = True
            Shape1.Move X, Y, 0, 0
            preX = X
            preY = Y
        End If
    End SubPrivate Sub SSTab1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Dim x1, x2, y1, y2
        
        If Moveenable And Button = 1 Then
            If preY > Y Then
                y1 = Y
                y2 = preY
            Else
                y1 = preY
                y2 = Y
            End If
            If preX > X Then
                x1 = X
                x2 = preX
            Else
                x1 = preX
                x2 = X
            End If
            Shape1.Move x1, y1, Abs(x1 - x2), Abs(y1 - y2)
        
        End If
    End SubPrivate Sub SSTab1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Moveenable And Button = 1 Then
            Shape1.Visible = False
            Set List1.Container = SSTab1
            Moveenable = False
            List1.Move Shape1.Left, Shape1.Top, Shape1.Width, Shape1.Height
            Form1.MousePointer = 0
        End If
        
    End Sub