home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / displa1r / frmdrag.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-03  |  2.9 KB  |  84 lines

  1. VERSION 5.00
  2. Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
  3. Begin VB.Form FrmDrag 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Drag & Drop Demonstration"
  6.    ClientHeight    =   2505
  7.    ClientLeft      =   240
  8.    ClientTop       =   1545
  9.    ClientWidth     =   7230
  10.    Icon            =   "FrmDrag.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2505
  15.    ScaleWidth      =   7230
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin RichTextLib.RichTextBox rt1 
  18.       Height          =   2415
  19.       Left            =   3120
  20.       TabIndex        =   1
  21.       Top             =   0
  22.       Width           =   4095
  23.       _ExtentX        =   7223
  24.       _ExtentY        =   4260
  25.       _Version        =   393217
  26.       Enabled         =   -1  'True
  27.       ScrollBars      =   3
  28.       RightMargin     =   10000
  29.       TextRTF         =   $"FrmDrag.frx":0442
  30.    End
  31.    Begin VB.ListBox List1 
  32.       Height          =   2400
  33.       ItemData        =   "FrmDrag.frx":04F0
  34.       Left            =   0
  35.       List            =   "FrmDrag.frx":04F2
  36.       OLEDropMode     =   1  'Manual
  37.       TabIndex        =   0
  38.       Top             =   0
  39.       Width           =   3015
  40.    End
  41. Attribute VB_Name = "FrmDrag"
  42. Attribute VB_GlobalNameSpace = False
  43. Attribute VB_Creatable = False
  44. Attribute VB_PredeclaredId = True
  45. Attribute VB_Exposed = False
  46. 'The settings for format are:
  47. 'Constant       Value       Description
  48. 'vbCFText       1           Text (.txt files)
  49. 'vbCFBitmap     2           Bitmap (.bmp files)
  50. 'vbCFMetafile   3           metafile (.wmf files)
  51. 'vbCFEMetafile  14          Enhanced metafile (.emf files)
  52. 'vbCFDIB        8           Device-independent bitmap (DIB)
  53. 'vbCFPalette    9           Color palette
  54. 'vbCFFiles      15          List of files
  55. 'vbCFRTF        -16639      Rich text format (.rtf files)
  56. Private Sub Form_Load()
  57. List1.OLEDropMode = 1
  58. List1.OLEDragMode = 1
  59. rt1.OLEDropMode = 1
  60. End Sub
  61. Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
  62. Dim i%
  63. If Data.GetFormat(vbCFFiles) Then
  64.     Caption = Data.Files.Count & " object(s) selected"
  65.     List1.Clear
  66.     For i = 1 To Data.Files.Count
  67.         List1.AddItem Data.Files(i%)
  68.     Next i
  69. End If
  70. ''' if drag text from rt1
  71. 'If Data.GetFormat(vbCFText) Then
  72. '    List1.AddItem "Text : " & Data.GetData(vbCFText)
  73. 'End If
  74. End Sub
  75. Private Sub rt1_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
  76. If Data.GetFormat(vbCFText) Then
  77.     rt1.LoadFile Data.GetData(vbCFText), rtfText
  78. End If
  79. If Data.GetFormat(vbCFFiles) Then
  80.     rt1.LoadFile Data.Files(1), rtfText  'Load one file for demo
  81. End If
  82. Caption = rt1.FileName
  83. End Sub
  84.