Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Picalausa François
"Gerald" a écrit dans le message de news: %23sC$
est-ce qqun aurait un exemple de drag'n drop d'un listview vers un treeView
Hello,
Voici un exemple: Option Explicit
Private Sub Form_Load() 'A définir en design time ListView1.OLEDragMode = ccOLEDragAutomatic
Dim i As Long
For i = 1 To 20 ListView1.ListItems.Add , , CStr(i) Next i
End Sub
'(Optionnel; default = copie) Private Sub ListView1_OLECompleteDrag(Effect As Long) 'Supprime l'item de la liste ListView1.ListItems.Remove ListView1.SelectedItem.Index End Sub
'(Optionnel; default = copie) Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long) 'Indique qu'on ne peut que déplacer l'item AllowedEffects = OLEDropEffectConstants.vbDropEffectMove End Sub
Private Sub TreeView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single) 'Retrouve l'item sur lequel notre item a été droppé Dim TreeNode As Node
Set TreeNode = TreeView1.HitTest(x, y)
If Not TreeNode Is Nothing Then 'Ajoute un noeud root TreeView1.Nodes.Add TreeNode, TreeRelationshipConstants.tvwChild, , Data.GetData(vbCFText) TreeNode.Expanded = True Else 'Ajoute un noeud root TreeView1.Nodes.Add , , , Data.GetData(vbCFText) End If End Sub
Pour plus d'infos, voir: http://msdn.microsoft.com/library/en-us/vbcon98/html/vbconoledragdrop.asp
-- Picalausa François
"Gerald" <gerald.andrez@gmail.com> a écrit dans le message de news:
%23sC$8jweGHA.1456@TK2MSFTNGP04.phx.gbl...
est-ce qqun aurait un exemple de drag'n drop d'un listview vers un
treeView
Hello,
Voici un exemple:
Option Explicit
Private Sub Form_Load()
'A définir en design time
ListView1.OLEDragMode = ccOLEDragAutomatic
Dim i As Long
For i = 1 To 20
ListView1.ListItems.Add , , CStr(i)
Next i
End Sub
'(Optionnel; default = copie)
Private Sub ListView1_OLECompleteDrag(Effect As Long)
'Supprime l'item de la liste
ListView1.ListItems.Remove ListView1.SelectedItem.Index
End Sub
'(Optionnel; default = copie)
Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject,
AllowedEffects As Long)
'Indique qu'on ne peut que déplacer l'item
AllowedEffects = OLEDropEffectConstants.vbDropEffectMove
End Sub
Private Sub TreeView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As
Long, Button As Integer, Shift As Integer, x As Single, y As Single)
'Retrouve l'item sur lequel notre item a été droppé
Dim TreeNode As Node
Set TreeNode = TreeView1.HitTest(x, y)
If Not TreeNode Is Nothing Then
'Ajoute un noeud root
TreeView1.Nodes.Add TreeNode, TreeRelationshipConstants.tvwChild, ,
Data.GetData(vbCFText)
TreeNode.Expanded = True
Else
'Ajoute un noeud root
TreeView1.Nodes.Add , , , Data.GetData(vbCFText)
End If
End Sub
Pour plus d'infos, voir:
http://msdn.microsoft.com/library/en-us/vbcon98/html/vbconoledragdrop.asp
est-ce qqun aurait un exemple de drag'n drop d'un listview vers un treeView
Hello,
Voici un exemple: Option Explicit
Private Sub Form_Load() 'A définir en design time ListView1.OLEDragMode = ccOLEDragAutomatic
Dim i As Long
For i = 1 To 20 ListView1.ListItems.Add , , CStr(i) Next i
End Sub
'(Optionnel; default = copie) Private Sub ListView1_OLECompleteDrag(Effect As Long) 'Supprime l'item de la liste ListView1.ListItems.Remove ListView1.SelectedItem.Index End Sub
'(Optionnel; default = copie) Private Sub ListView1_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long) 'Indique qu'on ne peut que déplacer l'item AllowedEffects = OLEDropEffectConstants.vbDropEffectMove End Sub
Private Sub TreeView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single) 'Retrouve l'item sur lequel notre item a été droppé Dim TreeNode As Node
Set TreeNode = TreeView1.HitTest(x, y)
If Not TreeNode Is Nothing Then 'Ajoute un noeud root TreeView1.Nodes.Add TreeNode, TreeRelationshipConstants.tvwChild, , Data.GetData(vbCFText) TreeNode.Expanded = True Else 'Ajoute un noeud root TreeView1.Nodes.Add , , , Data.GetData(vbCFText) End If End Sub
Pour plus d'infos, voir: http://msdn.microsoft.com/library/en-us/vbcon98/html/vbconoledragdrop.asp