100分求救,具体如下:新建一个工程,在默认的Form1上放置两个不相干的Picture1和Picture2,再放置一个Shape矩形框,将Picture2尽量拉大一些。并在Form1里面插入如下代码:Option ExplicitDim bx As Integer
Dim by As IntegerDim oLeft As Integer
Dim oTop As Integer
Dim oWidth As Integer
Dim oHeight As IntegerPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        bx = X
        by = Y
        
        oLeft = Picture1.Left
        oTop = Picture1.Top
        oWidth = Picture1.Width
        oHeight = Picture1.Height
    End If
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        Shape1.Move oLeft + (X - bx), oTop + (Y - by), oWidth, oHeight
    End If
End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbLeftButton Then
        Picture1.Move Shape1.Left, Shape1.Top
    End If
End Sub运行程序,用鼠标按住Picture1,可以发现有个Shape边框,但是每当Shape移动Picture2上时就被遮住,如何克服这个问题?

解决方案 »

  1.   

    换成text1,backcolor设置为&H8000000F&,appearance设置为0-flat,就可以解决了
    Option ExplicitDim bx As Integer
    Dim by As IntegerDim oLeft As Integer
    Dim oTop As Integer
    Dim oWidth As Integer
    Dim oHeight As IntegerPrivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbLeftButton Then
            bx = X
            by = Y
            
            oLeft = Picture1.Left
            oTop = Picture1.Top
            oWidth = Picture1.Width
            oHeight = Picture1.Height
        End If
    End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbLeftButton Then
            Text1.Visible = True
            Text1.Move oLeft + (X - bx), oTop + (Y - by), oWidth, oHeight
        End If
    End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = vbLeftButton Then
            Picture1.Move Text1.Left, Text1.Top
            Text1.Visible = False
        End If
    End Sub
      

  2.   

    aiur2000(开始.NET):你的思路达不到我需要的效果。
      

  3.   

    To:cuizm(射天狼)我的Email:[email protected]