home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form OLEDDManForm
- Caption = "Manual OLE Drag & Drop"
- ClientHeight = 6660
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 10530
- LinkTopic = "Form1"
- ScaleHeight = 6660
- ScaleWidth = 10530
- StartUpPosition = 3 'Windows Default
- Begin VB.CheckBox Check1
- Caption = "AutoVerbMenu"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 2880
- TabIndex = 6
- Top = 6240
- Width = 2295
- End
- Begin VB.CommandButton OLEObjects
- Caption = "List All Objects"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 465
- Left = 150
- TabIndex = 5
- Top = 6090
- Width = 2370
- End
- Begin VB.CommandButton Command2
- Caption = "Load Text File"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 465
- Left = 5535
- TabIndex = 4
- Top = 6090
- Width = 2370
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2115
- Left = 5535
- MultiLine = -1 'True
- OLEDragMode = 1 'Automatic
- OLEDropMode = 1 'Manual
- ScrollBars = 2 'Vertical
- TabIndex = 3
- Text = "OLEDDMAN.frx":0000
- Top = 3855
- Width = 4815
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 8025
- Top = 3195
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.CommandButton Command1
- Caption = "Load Image"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 465
- Left = 5535
- TabIndex = 2
- Top = 3240
- Width = 2370
- End
- Begin VB.PictureBox Picture1
- Height = 2940
- Left = 5535
- OLEDragMode = 1 'Automatic
- ScaleHeight = 2880
- ScaleWidth = 4800
- TabIndex = 1
- Top = 165
- Width = 4860
- End
- Begin RichTextLib.RichTextBox RichTextBox1
- Height = 5820
- Left = 120
- TabIndex = 0
- Top = 150
- Width = 5235
- _ExtentX = 9234
- _ExtentY = 10266
- _Version = 393217
- ScrollBars = 2
- OLEDropMode = 1
- TextRTF = $"OLEDDMAN.frx":0006
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Attribute VB_Name = "OLEDDManForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim PWidth As Long, PHeight As Long
- Private Sub Check1_Click()
- If Check1.Value = 1 Then
- RichTextBox1.AutoVerbMenu = True
- Else
- RichTextBox1.AutoVerbMenu = False
- End If
- End Sub
- Private Sub Command1_Click()
- CommonDialog1.Filter = "Images|*.bmp;*.gif;*.tif"
- CommonDialog1.InitDir = App.Path
- CommonDialog1.FileName = ""
- CommonDialog1.ShowOpen
- If CommonDialog1.FileName = "" Then Exit Sub
- Picture1.Picture = LoadPicture(CommonDialog1.FileName)
- OLEDDManForm.Palette = LoadPicture(CommonDialog1.FileName)
- ResizePBox
- End Sub
- Private Sub Command2_Click()
- CommonDialog1.Filter = "Text Files|*.txt|All Files|*.*"
- CommonDialog1.InitDir = App.Path
- CommonDialog1.FileName = ""
- CommonDialog1.ShowOpen
- If CommonDialog1.FileName = "" Then Exit Sub
- FNum = FreeFile
- Open CommonDialog1.FileName For Input As #FNum
- allTxt = Input(LOF(FNum), #FNum)
- Close FNum
- Text1.Text = allTxt
- End Sub
- Private Sub Command3_Click()
- For i = 0 To RichTextBox1.OLEObjects.Count
- Debug.Print RichTextBox1.OLEObjects.Item(i).Class
- Next
- End Sub
- Private Sub Form_Load()
- PWidth = Picture1.Width
- PHeight = Picture1.Height
- End Sub
- Sub ResizePBox()
- Dim imgWidth As Long, imgHeight As Long
- Picture1.Enabled = False
- imgWidth = Round(ScaleX(Picture1.Picture.Width, vbHimetric, vbTwips))
- imgHeight = Round(ScaleY(Picture1.Picture.Height, vbHimetric, vbTwips))
- If imgWidth < PWidth Then Picture1.Width = imgWidth
- If imgHeight < PHeight Then Picture1.Height = imgHeight
- Picture1.Enabled = True
- End Sub
- Private Sub OLEObjects_Click()
- For i = 0 To RichTextBox1.OLEObjects.Count - 1
- Debug.Print RichTextBox1.OLEObjects.Item(i).Class
- Next
- End Sub
- Private Sub Picture1_OLECompleteDrag(Effect As Long)
- RichTextBox1.OLEDropMode = rtfOLEDropManual
- End Sub
- Private Sub Picture1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
- RichTextBox1.OLEDropMode = rtfOLEDropAutomatic
- End Sub
- Private Sub RichTextBox1_OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
- Dim FNum As Integer
- If Data.GetFormat(vbCFText) Then
- RichTextBox1.SelText = Data.GetData(vbCFText)
- End If
- If Data.GetFormat(vbCFRTF) Then
- RichTextBox1.SelRTF = Data.GetData(vbCFRTF)
- GoTo PasteDone
- End If
- If Data.GetFormat(vbCFBitmap) Or Data.GetFormat(vbCFDIB) Then
- RichTextBox1.OLEObjects.Add , , Data.GetData(vbCFDIB)
- GoTo PasteDone
- End If
- If Data.GetFormat(vbCFFiles) Then
- For i = 1 To Data.Files.Count
- If UCase(Right(Data.Files(i), 4)) = ".RTF" Then
- FNum = FreeFile
- Open Data.Files(i) For Binary As FNum
- RichTextBox1.SelRTF = Input$(LOF(FNum), FNum)
- Close FNum
- Else
- RichTextBox1.OLEObjects.Add , , Data.Files(i)
- End If
- Next
- End If
- PasteDone:
- End Sub
- Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
- Dim pic As Picture
- If Data.GetFormat(vbCFFiles) Then
- Text1.Text = "You dropped the following files :" & vbCrLf
- For i = 1 To Data.Files.Count
- Text1.Text = Text1.Text & Data.Files(i) & vbCrLf
- Next
- End If
- If Data.GetFormat(vbCFRTF) Then
- Text1.Text = Data.GetData(vbCFText)
- End If
- If Data.GetFormat(vbCFBitmap) Then
- imgWidth = Round(ScaleX(Data.GetData(vbCFBitmap).Width, vbHimetric, vbPixels))
- imgHeight = Round(ScaleY(Data.GetData(vbCFBitmap).Height, vbHimetric, vbPixels))
- Text1.Text = "You dropped an image with the following specifications:" & vbCrLf
- Text1.Text = Text1.Text & "WIDTH " & imgWidth & vbCrLf
- Text1.Text = Text1.Text & "HEIGHT " & imgHeight
- End If
- End Sub
-