home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch04 / dragdrop / dragdrop.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-03-07  |  3.3 KB  |  102 lines

  1. VERSION 5.00
  2. Begin VB.Form DragDrop 
  3.    Caption         =   "DragDrop Demo"
  4.    ClientHeight    =   4890
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   5580
  8.    LinkTopic       =   "Form2"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   4890
  11.    ScaleWidth      =   5580
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.PictureBox Picture1 
  14.       Height          =   3015
  15.       Left            =   240
  16.       ScaleHeight     =   2955
  17.       ScaleWidth      =   5115
  18.       TabIndex        =   2
  19.       Top             =   825
  20.       Width           =   5175
  21.    End
  22.    Begin VB.TextBox Text1 
  23.       DragMode        =   1  'Automatic
  24.       Height          =   330
  25.       Left            =   2925
  26.       TabIndex        =   1
  27.       Top             =   225
  28.       Width           =   2490
  29.    End
  30.    Begin VB.Label Label2 
  31.       BorderStyle     =   1  'Fixed Single
  32.       Caption         =   $"DragDrop.frx":0000
  33.       BeginProperty Font 
  34.          Name            =   "MS Sans Serif"
  35.          Size            =   9.75
  36.          Charset         =   0
  37.          Weight          =   400
  38.          Underline       =   0   'False
  39.          Italic          =   0   'False
  40.          Strikethrough   =   0   'False
  41.       EndProperty
  42.       Height          =   810
  43.       Left            =   255
  44.       TabIndex        =   3
  45.       Top             =   3975
  46.       Width           =   5160
  47.    End
  48.    Begin VB.Label Label1 
  49.       BorderStyle     =   1  'Fixed Single
  50.       DragMode        =   1  'Automatic
  51.       Height          =   330
  52.       Left            =   210
  53.       TabIndex        =   0
  54.       Top             =   225
  55.       Width           =   2490
  56.    End
  57. Attribute VB_Name = "DragDrop"
  58. Attribute VB_GlobalNameSpace = False
  59. Attribute VB_Creatable = False
  60. Attribute VB_PredeclaredId = True
  61. Attribute VB_Exposed = False
  62. Option Explicit
  63. Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  64.     If State = 0 Then Source.MousePointer = 12
  65.     If State = 1 Then Source.MousePointer = 0
  66. End Sub
  67. Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
  68. If TypeOf Source Is TextBox Then
  69.     Label1.Caption = Source.Text
  70. End If
  71. End Sub
  72. Private Sub Label1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  73.     MousePointer = vbDefault
  74. End Sub
  75. Private Sub Label2_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  76.     If State = 0 Then Source.MousePointer = 12
  77.     If State = 1 Then Source.MousePointer = 0
  78. End Sub
  79. Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
  80. Dim imgName
  81. If TypeOf Source Is TextBox Then
  82.     imgName = Source.Text
  83.     imgName = Source.Caption
  84. End If
  85. On Error GoTo NOIMAGE
  86. Picture1.Picture = LoadPicture(imgName)
  87. Exit Sub
  88. NOIMAGE:
  89.     MsgBox "This is not a valid file name"
  90. End Sub
  91. Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  92.     MousePointer = vbDefault
  93. End Sub
  94. Private Sub Text1_DragDrop(Source As Control, X As Single, Y As Single)
  95. If TypeOf Source Is Label Then
  96.     Text1.Text = Label1.Caption
  97. End If
  98. End Sub
  99. Private Sub Text1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  100.     MousePointer = vbDefault
  101. End Sub
  102.