====有关使用Shape控件用作移动边框的疑问:如何使Shapre边框始终在前====
alj 2004-11-23 12:10:20 100分求救,具体如下:
新建一个工程,在默认的Form1上放置两个不相干的Picture1和Picture2,再放置一个Shape矩形框,将Picture2尽量拉大一些。并在Form1里面插入如下代码:
Option Explicit
Dim bx As Integer
Dim by As Integer
Dim oLeft As Integer
Dim oTop As Integer
Dim oWidth As Integer
Dim oHeight As Integer
Private 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 Sub
Private 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 Sub
Private 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上时就被遮住,如何克服这个问题?