home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / PGUIDE / MOUSE / DRAG.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-30  |  4.6 KB  |  151 lines

  1. VERSION 5.00
  2. Begin VB.Form frmDrag 
  3.    Caption         =   "
  4.    ClientHeight    =   2670
  5.    ClientLeft      =   2130
  6.    ClientTop       =   3780
  7.    ClientWidth     =   6405
  8.    ClipControls    =   0   'False
  9.    LinkTopic       =   "Form2"
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   2670
  13.    ScaleWidth      =   6405
  14.    Begin VB.DriveListBox Drive1 
  15.       DragIcon        =   "DRAG.frx":0000
  16.       BeginProperty Font 
  17.          Name            =   "
  18.          Size            =   9
  19.          Charset         =   134
  20.          Weight          =   700
  21.          Underline       =   0   'False
  22.          Italic          =   0   'False
  23.          Strikethrough   =   0   'False
  24.       EndProperty
  25.       Height          =   315
  26.       Left            =   120
  27.       TabIndex        =   2
  28.       Top             =   120
  29.       Width           =   1935
  30.    End
  31.    Begin VB.FileListBox File1 
  32.       BeginProperty Font 
  33.          Name            =   "
  34.          Size            =   9
  35.          Charset         =   134
  36.          Weight          =   700
  37.          Underline       =   0   'False
  38.          Italic          =   0   'False
  39.          Strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   2250
  42.       Left            =   2280
  43.       Pattern         =   "*.txt;*.bmp;*.exe;*.hlp"
  44.       TabIndex        =   1
  45.       Top             =   120
  46.       Width           =   2052
  47.    End
  48.    Begin VB.DirListBox Dir1 
  49.       DragIcon        =   "DRAG.frx":030A
  50.       BeginProperty Font 
  51.          Name            =   "
  52.          Size            =   9
  53.          Charset         =   134
  54.          Weight          =   700
  55.          Underline       =   0   'False
  56.          Italic          =   0   'False
  57.          Strikethrough   =   0   'False
  58.       EndProperty
  59.       Height          =   1920
  60.       Left            =   120
  61.       TabIndex        =   0
  62.       Top             =   600
  63.       Width           =   1935
  64.    End
  65.    Begin VB.Image Image1 
  66.       BorderStyle     =   1  'Fixed Single
  67.       Height          =   2295
  68.       Left            =   4560
  69.       Stretch         =   -1  'True
  70.       Top             =   120
  71.       Width           =   1725
  72.    End
  73. Attribute VB_Name = "frmDrag"
  74. Attribute VB_GlobalNameSpace = False
  75. Attribute VB_Creatable = False
  76. Attribute VB_PredeclaredId = True
  77. Attribute VB_Exposed = False
  78. Private Sub Dir1_Change()
  79.     File1.Path = Dir1.Path
  80. End Sub
  81. Private Sub Drive1_Change()
  82.     On Error GoTo DriveErrs
  83.     Dir1.Path = Drive1.Drive
  84. Exit Sub
  85. DriveErrs:
  86.     Select Case Err
  87.         Case 68
  88.             MsgBox prompt:="
  89.             buttons:=vbExclamation
  90.             ' 
  91.             Drive1.Drive = Dir1.Path
  92.             Exit Sub
  93.         Case Else
  94.             MsgBox prompt:="
  95. ", buttons:=vbExclamation
  96.     End Select
  97. End Sub
  98. Private Sub File1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  99.     File1.DragIcon = Drive1.DragIcon
  100.     File1.Drag
  101. End Sub
  102. Private Sub Form_Load()
  103.     frmDrag.Width = 6525
  104.     frmDrag.Height = 3075
  105. End Sub
  106. Private Sub Image1_DragDrop(Source As Control, X As Single, Y As Single)
  107.     ' 
  108.     temp = LCase(Right$(File1.filename, 3))
  109.     ' 
  110.     If Mid(File1.Path, Len(File1.Path)) = "\" Then
  111.       dropfile = File1.Path & File1.filename
  112.     ' 
  113.  "\" 
  114.     Else
  115.       dropfile = File1.Path & "\" & File1.filename
  116.     End If
  117.       
  118.     Image1.Picture = LoadPicture("")
  119.     Select Case UCase$(Trim$(temp))
  120.     Case "TXT"
  121.         X = Shell("Notepad " + dropfile, 1)
  122.     Case "BMP"
  123.         Image1.Picture = LoadPicture(dropfile)
  124.     Case "EXE"
  125.         X = Shell(dropfile, 1)
  126.     Case "HLP"
  127.         X = Shell("WinHelp " + dropfile, 1)
  128.     Case Else
  129.         nl = Chr$(10) + Chr$(13)
  130.         msg = "
  131.         msg = vbCrLf & msg & vbCrLf & vbCrLf & "     .txt, .bmp, .exe, .hlp"
  132.         MsgBox msg
  133.     End Select
  134. End Sub
  135. Private Sub Image1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
  136.     Select Case State
  137.     Case 0
  138.         ' 
  139.         File1.DragIcon = Dir1.DragIcon
  140.     Case 1
  141.         ' 
  142.  DragIcon 
  143.         File1.DragIcon = Drive1.DragIcon
  144.     End Select
  145.  Dir1.DragIcon 
  146.  Drive1.DragIcon 
  147.  File1 
  148.  "Enter" 
  149.  "Leave" 
  150. End Sub
  151.