home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l407 / 1.ddi / DRAG.FR_ / DRAG.bin (.txt)
Encoding:
Visual Basic Form  |  1993-04-28  |  3.7 KB  |  119 lines

  1. VERSION 2.00
  2. Begin Form frmDrag 
  3.    Caption         =   "Drag Drop"
  4.    ClientHeight    =   2670
  5.    ClientLeft      =   1500
  6.    ClientTop       =   2040
  7.    ClientWidth     =   6405
  8.    ClipControls    =   0   'False
  9.    Height          =   3075
  10.    Left            =   1440
  11.    LinkTopic       =   "Form2"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   2670
  14.    ScaleWidth      =   6405
  15.    Top             =   1695
  16.    Width           =   6525
  17.    Begin DriveListBox Drive1 
  18.       DragIcon        =   DRAG.FRX:0000
  19.       Height          =   315
  20.       Left            =   120
  21.       TabIndex        =   2
  22.       Top             =   120
  23.       Width           =   1935
  24.    End
  25.    Begin FileListBox File1 
  26.       FontBold        =   -1  'True
  27.       FontItalic      =   0   'False
  28.       FontName        =   "System"
  29.       FontSize        =   9.75
  30.       FontStrikethru  =   0   'False
  31.       FontUnderline   =   0   'False
  32.       Height          =   2190
  33.       Left            =   2280
  34.       Pattern         =   "*.txt;*.bmp;*.exe;*.hlp"
  35.       TabIndex        =   1
  36.       Top             =   120
  37.       Width           =   2055
  38.    End
  39.    Begin DirListBox Dir1 
  40.       DragIcon        =   DRAG.FRX:0302
  41.       FontBold        =   -1  'True
  42.       FontItalic      =   0   'False
  43.       FontName        =   "System"
  44.       FontSize        =   9.75
  45.       FontStrikethru  =   0   'False
  46.       FontUnderline   =   0   'False
  47.       Height          =   1920
  48.       Left            =   120
  49.       TabIndex        =   0
  50.       Top             =   600
  51.       Width           =   1935
  52.    End
  53.    Begin Image Image1 
  54.       BorderStyle     =   1  'Fixed Single
  55.       Height          =   2415
  56.       Left            =   4560
  57.       Stretch         =   -1  'True
  58.       Top             =   120
  59.       Width           =   1725
  60.    End
  61. Sub Dir1_Change ()
  62.     file1.Path = Dir1.Path
  63. End Sub
  64. Sub Drive1_Change ()
  65.     Dir1.Path = Drive1.Drive
  66. End Sub
  67. Sub File1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  68.     file1.DragIcon = Drive1.DragIcon
  69.     file1.Drag
  70. End Sub
  71. Sub Form_Load ()
  72.     frmDrag.Width = 6525
  73.     frmDrag.Height = 3075
  74. End Sub
  75. Sub Image1_DragDrop (Source As Control, X As Single, Y As Single)
  76.     ' Get last three letters of the dragged filename
  77.     temp = Right$(file1.FileName, 3)
  78.     ' If dragged file is in the root, append filename.
  79.     If Mid(file1.Path, Len(file1.Path)) = "\" Then
  80.       dropfile = file1.Path & file1.FileName
  81.     ' If dragged file is not in root, append "\" and filename.
  82.     Else
  83.       dropfile = file1.Path & "\" & file1.FileName
  84.     End If
  85.       
  86.     image1.Picture = LoadPicture("")
  87.     Select Case temp
  88.     Case "txt"
  89.         X = Shell("Notepad " + dropfile, 1)
  90.     Case "bmp", "wmf", "rle", "ico"
  91.         image1.Picture = LoadPicture(dropfile)
  92.     Case "exe"
  93.         X = Shell(dropfile, 1)
  94.     Case "hlp"
  95.         X = Shell("WinHelp " + dropfile, 1)
  96.     Case Else
  97.         nl = Chr$(10) + Chr$(13)
  98.         msg = "Try one of these file types:"
  99.         msg = nl + msg + nl + nl + "     .txt, .bmp, .exe, .hlp"
  100.         MsgBox msg
  101.     End Select
  102. End Sub
  103. Sub Image1_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  104.     Select Case State
  105.     Case 0
  106.         ' Display a new icon when the source
  107.         ' enters the drop area.
  108.         file1.DragIcon = Dir1.DragIcon
  109.     Case 1
  110.         ' Display the original DragIcon when the source
  111.         ' leaves the drop area.
  112.         file1.DragIcon = Drive1.DragIcon
  113.     End Select
  114. ' Note that Dir1.DragIcon and Drive1.DragIcon have been
  115. ' set at design time. This allows you to load the "Enter
  116. ' and "Leave" icons for File1 at runtime without requiring
  117. ' that the user has those icons are on disc.
  118. End Sub
  119.