OLEStartDrag (ILEADRasterImgList) example for Visual Basic
Option Explicit
Public WithEvents LEADThumb1 As LEADRasterThumbnail
Dim x As Integer
Dim strHistory As String
Private Sub FillThumbs_Click()
Set LEADThumb1 = New LEADRasterThumbnail
Screen.MousePointer = vbHourglass
LEADThumb1.Filter = "*.jpg"
LEADThumb1.EnableMethodErrors = False
LEADThumb1.ThumbnailWidth = 150
LEADThumb1.ThumbnailHeight = 150
LEADThumb1.MaintainAspect = True
LEADThumb1.ForceSize = False
LEADThumb1.Resample = False
LEADThumb1.StopOnError = False
LEADThumb1.LoadStamp = False
LEADThumb1.IncludeSubDirectories = False
LEADThumb1.ExpandMultipage = False
LEADThumb1.ThumbnailBitsPerPixel = 24
LEADThumb1.MaxSizeMem = 0 'set a size limit
LEADThumb1.BrowseDir App.Path
Screen.MousePointer = vbDefault
End Sub
Private Sub History_Click()
MsgBox strHistory
End Sub
Private Sub LEADImgList1_OLECompleteDrag(ByVal
Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As
Long)
strHistory = strHistory + "Drag Complete for Item#"
+ Str(LEADImgList1.HitTest(x, y)) + Chr(10)
End Sub
Private Sub LEADImgList1_OLEDragOver (ByVal Button
As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
strHistory = strHistory + "Drag Over Item#"
+ Str(LEADImgList1.HitTest(x, y)) + Chr(10)
End Sub
Private Sub LEADImgList1_OLEGiveFeedback ()
LEADImgList1.EnableUseDefaultCursor
= False
End Sub
Private Sub LEADImgList1_OLEStartDrag (ByVal
Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As
Long)
strHistory = strHistory + "Drag Start for Item#"
+ Str(LEADImgList1.HitTest(x, y)) + Chr(10)
End Sub
Private Sub LEADImgList2_OLEGiveFeedback ()
LEADImgList2.EnableUseDefaultCursor = False
End Sub
Private Sub LEADThumb1_ThumbnailEvent(ByVal Bitmap As Long, ByVal pszFilename
As String, ByVal nStatusCode As Integer, ByVal nPercent As Integer)
If (nStatusCode = BROWSE_LOADING Or nStatusCode = BROWSE_PRELOAD)
Then GoTo EVENTOUT 'loading a file
If (nStatusCode = 0) Then
AddItem pszFilename,
Bitmap, LEADThumb1.InfoFormat, LEADThumb1.InfoWidth, LEADThumb1.InfoHeight,
LEADThumb1.InfoBits, LEADThumb1.InfoCompression, LEADThumb1.InfoTotalPages,
LEADThumb1.InfoSizeDisk, LEADThumb1.InfoSizeMem, LEADThumb1.InfoXRes,
LEADThumb1.InfoYRes
End If
EVENTOUT:
LEADThumb1.ContinueBrowse = True
End Sub
Private Sub Form_Load()
LEADImgList1.DisplayItemText = True
LEADImgList1.ScrollStyle = IMGLST_SCROLLSTYLE_VERTICAL
LEADImgList1.ItemHeight = 150
LEADImgList1.ItemWidth = 150
LEADImgList1.AllowSelection = IMGLST_ALLOWSELECTION_MULTI
LEADImgList2.DisplayItemText = True
LEADImgList2.ScrollStyle = IMGLST_SCROLLSTYLE_VERTICAL
LEADImgList2.ItemHeight = 150
LEADImgList2.ItemWidth = 150
LEADImgList2.AllowSelection = IMGLST_ALLOWSELECTION_MULTI
End Sub
Private Sub AddItem(pszFilename As String, Bitmap As Long, InfoFormat As
Integer, InfoWidth As Integer, InfoHeight As Integer, InfoBits As Integer,
InfoCompression As String, InfoTotalPages As Integer, InfoSizeDisk As
Long, InfoSizeMem As Long, InfoXRes As Integer, InfoYRes As Integer)
LEADImgList1.Insert Bitmap, pszFilename, 1
LEADImgList1.EnsureVisible (LEADImgList1.Count - 1)
End Sub
Private Sub StartDrag_Click()
LEADImgList1.EnableOLEDragMethod
= True
LEADImgList2.EnableOLEDragMethod = True
LEADImgList1.OLEDragCursor = Me.MouseIcon
LEADImgList2.OLEDragCursor = Me.MouseIcon
End Sub
Private Sub StopDrag_Click()
LEADImgList1.EnableOLEDragMethod
= False
LEADImgList2.EnableOLEDragMethod = False
End Sub