Private Sub Command1_Click()
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "Язык"
ListView1.ColumnHeaders.Add , , "Синтаксис блоков"
ListView1.ListItems.Add(, , "Java").SubItems(1) = "{ }"
ListView1.ListItems.Add(, , "VBScript").SubItems(1) = "* End*"
ListView1.ListItems.Add(, , "Visua Basic").SubItems(1) = "* End*"
ListView1.ListItems.Add(, , "Pascal").SubItems(1) = "BEGIN END"
ListView1.ListItems.Add(, , "C++").SubItems(1) = "{ }"
ListView1.ListItems.Add(, , "QBasic").SubItems(1) = "* END*"
ListView1.OLEDragMode = ccOLEDragAutomatic
ListView1.OLEDropMode = 1
End Sub
Private Sub Form_Load()
Me.Width = 6750
Me.Height = 5415
ListView1.Height = 4110
ListView1.Width = 6390
ListView1.Top = 735
ListView1.Left = 90
Command1.Top = 75
Command1.Left = 90
Command1.Height = 570
Command1.Width = 6375
Command1.Caption = "ЗАПОЛНИТЬ LIST-VIEW"
End Sub
Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim li As ListItem
Dim nc As Long
nc = ListView1.ListItems.Count
cSubItems = ListView1.FindItem(Data.GetData(1)).SubItems(1)
Effect = OLEDropEffectConstants.vbDropEffectMove
Set li = ListView1.ListItems.Item(1)
Set li = ListView1.ListItems.Add(Switch(y \ li.Height > nc, nc + 1, y \ li.Height < 1, 1, True, y \ li.Height), , Data.GetData(1))
li.SubItems(1) = cSubItems
End Sub
Private Sub ListView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim li As ListItem
Dim nc As Long
Dim SubItemsBuffer() As String
nc = ListView1.ListItems.Count
ReDim SubItemsBuffer(1 To ListView1.ColumnHeaders.Count)
For i = 1 To ListView1.ColumnHeaders.Count
SubItemsBuffer(i) = ListView1.FindItem(Data.GetData(1)).SubItems(i)
next i
cSubItems = ListView1.FindItem(Data.GetData(1)).SubItems(1)
Effect = OLEDropEffectConstants.vbDropEffectMove
Set li = ListView1.ListItems.Item(1)
NewPosition = (Y \ li.Height )
If NewPosition = 0 Then NewPosition = 1
If NewPosition > nc Then NewPositon = nc
Set li = ListView1.ListItems.Add(NewPosition), , Data.GetData(1))
For i = 1 To ListView1.ColumnHeaders.Count
Li.SubItems(i) = SubItemsBuffer(i)
next i
End Sub
Сейчас этот форум просматривают: Google-бот и гости: 157