OLEStartDrag (Main Control) example for Visual Basic

Dim strHistory As String
Private Sub Form_Load()
  LEAD1.Load "c:\Test.cmp", 0, 0, 1
End Sub

Private Sub History_Click()
   MsgBox strHistory
End Sub

Private Sub LEAD1_OLECompleteDrag(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEAD1: OLE Complete Drag at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEAD1_OLEDragOver(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEAD1: OLE Drag Over at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEAD1_OLEGiveFeedback(pbUseDefaultCursor As Boolean)
   pbUseDefaultCursor = False
End Sub

Private Sub LEAD1_OLEStartDrag(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
   strHistory = strHistory + "LEAD1: OLE Start Drag at pos X = " + CStr(x) + " and pos y = " + CStr(y)
End Sub

Private Sub LEAD2_OLEGiveFeedback(pbUseDefaultCursor As Boolean)
   pbUseDefaultCursor = False
End Sub

Private Sub StartDrag_Click()
  LEAD1.EnableOLEDragMethod = True
  LEAD2.EnableOLEDragMethod = True

  LEAD1.OLEDragCursor = LoadPicture("e:\lead14\com\leadbase.ico")
  LEAD2.OLEDragCursor = LoadPicture("e:\lead14\com\leadbase.ico")
End Sub

Private Sub StopDrag_Click()
  LEAD1.EnableOLEDragMethod = False
  LEAD2.EnableOLEDragMethod = False
End Sub