home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form DragDrop
- Caption = "Drag & Drop Operations"
- ClientHeight = 4650
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5370
- LinkTopic = "Form2"
- ScaleHeight = 4650
- ScaleWidth = 5370
- StartUpPosition = 3 'Windows Default
- Begin VB.PictureBox Picture1
- Height = 3015
- Left = 120
- ScaleHeight = 2955
- ScaleWidth = 5115
- TabIndex = 2
- Top = 585
- Width = 5175
- End
- Begin VB.TextBox Text1
- DragMode = 1 'Automatic
- Height = 330
- Left = 2820
- TabIndex = 1
- Top = 105
- Width = 2490
- End
- Begin VB.Label Label2
- BorderStyle = 1 'Fixed Single
- Caption = $"DragDrop.frx":0000
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 840
- Left = 120
- TabIndex = 3
- Top = 3720
- Width = 5160
- End
- Begin VB.Label Label1
- BorderStyle = 1 'Fixed Single
- DragMode = 1 'Automatic
- Height = 330
- Left = 105
- TabIndex = 0
- Top = 105
- Width = 2490
- End
- Attribute VB_Name = "DragDrop"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
- If State = 0 Then Source.MousePointer = 12
- If State = 1 Then Source.MousePointer = 0
- End Sub
- Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
- If TypeOf Source Is TextBox Then
- Label1.Caption = Source.Text
- End If
- End Sub
- Private Sub Label1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
- MousePointer = vbDefault
- End Sub
- Private Sub Label2_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
- If State = 0 Then Source.MousePointer = 12
- If State = 1 Then Source.MousePointer = 0
- End Sub
- Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
- Dim imgName
- If TypeOf Source Is TextBox Then
- imgName = Source.Text
- imgName = Source.Caption
- End If
- On Error GoTo NOIMAGE
- Picture1.Picture = LoadPicture(imgName)
- Exit Sub
- NOIMAGE:
- MsgBox "This is not a valid image file"
- End Sub
- Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
- MousePointer = vbDefault
- End Sub
- Private Sub Text1_DragDrop(Source As Control, X As Single, Y As Single)
- If TypeOf Source Is Label Then
- Text1.Text = Label1.Caption
- End If
- End Sub
- Private Sub Text1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
- MousePointer = vbDefault
- End Sub
-