err1: End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo err1 If Button = 1 Then Picture1.Move Picture1.Left + X Picture1.ZOrder (0) End If Exit Sub
err1: End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo err1 If Button = 1 Then Text1.Left = 0 If Picture1.Left < 1000 Then Text1.Width = 1000 Picture1.Left = 1000 Else If Picture1.Left > form1.Width Then Text1.Width = form1.Width - 500 Picture1.Left = Text1.Width Else Text1.Width = Picture1.Left End If End If
Text2.Left = Text1.Width + Picture1.Width Text2.Width = form1.Width - Text1.Width - Picture1.Width End If Exit Sub
'建一个窗体
'加入两个文本框(text1,text2)和一个图片框(picture1)
'*******************************************Private Sub Form_Load()
Picture1.MousePointer = 9
Picture1.Appearance = 0
Picture1.BackColor = &H8000000F
Picture1.BorderStyle = 0
Picture1.Width = 150
End SubPrivate Sub Form_Resize()
On Error GoTo err1
Text1.Top = 0
Text1.Left = 0
Text1.Width = 3000
Text1.Height = form1.Height
Picture1.Top = 0
Picture1.Left = Text1.Width - 50
Picture1.Height = form1.Height Text2.Top = 0
Text2.Left = Text1.Width + Picture1.Width - 50
Text2.Height = form1.Height
Text2.Width = form1.Width - Text1.Width - Picture1.Width
Exit Sub
err1:
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo err1
If Button = 1 Then
Picture1.Move Picture1.Left + X
Picture1.ZOrder (0)
End If
Exit Sub
err1:
End SubPrivate Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo err1
If Button = 1 Then
Text1.Left = 0
If Picture1.Left < 1000 Then
Text1.Width = 1000
Picture1.Left = 1000
Else
If Picture1.Left > form1.Width Then
Text1.Width = form1.Width - 500
Picture1.Left = Text1.Width
Else
Text1.Width = Picture1.Left
End If
End If
Text2.Left = Text1.Width + Picture1.Width
Text2.Width = form1.Width - Text1.Width - Picture1.Width
End If
Exit Sub
err1:
End Sub