Option Explicit
Public CurrentHighlightMode As Long
Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
lstItems.DragIcon = ImageList1.ListImages(2).ExtractIcon
End Sub
Private Sub Form_Load()
[COLOR=green]' fill the list box with some text[/color]
Call Load_Listbox
End Sub
Private Sub lstItems_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
lstItems.DragIcon = ImageList1.ListImages(1).ExtractIcon
End Sub
Private Sub lstItems_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
[COLOR=green]' test for left mouse button to start drag[/color]
If Button = vbLeftButton Then
CurrentHighlightMode = mfgData.HighLight
lstItems.Drag vbBeginDrag
End If
End Sub
Private Sub mfgData_DragDrop(Source As Control, X As Single, Y As Single)
[COLOR=green]' test for list box drag source[/color]
If Source.Name <> "lstItems" Then Exit Sub
[COLOR=green ]' use the flex grid mouse tracking to decide which cell to
' copy the text to...or use a specific row and/or column if
' you need to limit the copy to a certain cell[/color]
mfgData.TextMatrix(mfgData.MouseRow, mfgData.MouseCol) = Source.Text
mfgData.HighLight = CurrentHighlightMode
End Sub
Private Sub Load_Listbox()
[COLOR=green]' load the list box[/color]
lstItems.AddItem "Red"
lstItems.AddItem "Green"
lstItems.AddItem "Blue"
lstItems.AddItem "Yellow"
lstItems.AddItem "Pink"
End Sub
Private Sub mfgData_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
mfgData.SetFocus
lstItems.DragIcon = ImageList1.ListImages(3).ExtractIcon
With mfgData
.HighLight = flexHighlightWithFocus
.Col = .MouseCol
.Row = .MouseRow
End With
End Sub