SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
The tree control's OLEDrag method has been invoked.
VB.NET | Private Sub object_OLEStartDrag(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.OLEStartDrag |
VB | Private Sub object_OLEStartDrag(Data As DataObject, AllowedEffects As Long) |
C#.NET | void object_OLEStartDrag(object sender, EventArgumentType e); |
VC++ | void OnOLEStartDragobject(struct IVDMDataObject** Data, long* AllowedEffects); |
C | HRESULT OnOLEStartDragobject(struct IVDMDataObject** Data, long* AllowedEffects); |
object
Data
A DataObject object used to define formats that the source provides and optionally, the data for those formats. If no data is contained in the DataObject Data, it is provided when the target control calls the DataObject.GetData method and you should provide the values for the Data parameter.
AllowedEffects
Defines the effects that the source component supports. The source component should logically Or together the supported values and place the result in the AllowedEffects parameter. The target component can use this value to determine the appropriate action, and what the appropriate user feedback should be.
Effect | Value | Description |
---|---|---|
vbDropEffectNone | 0 | Drop target cannot accept the data. |
vbDropEffectCopy | 1 | Drop results in a copy of data from the source to the target. The original data is unaltered by the drag operation. |
vbDropEffectMove | 2 | Drop results in data being moved from the drag source to the drop source. The drag source should remove the data from itself after the move. |
Note: Only Visual Basic offers the predefined constants vbDropEffectNone, etc. When using other languages, the constants have to be defined explicitly by the application.
The OLEStartDrag event occurs when the tree control's OLEDrag method has been invoked.
This event specifies the data formats and drop effects that the source component supports. It can also be used to insert data into the DataObject object.
You may want to defer placing data into the DataObject object until the target component requests it. This allows the source component to save time by not loading multiple data formats. When the target performs the DataObject.GetData method on the DataObject, the source's OLESetData event will occur if the requested data is not contained in the DataObject. At this point, the data can be loaded into the DataObject, which will in turn provide the data to the target.
If the user does not load any formats into the DataObject, then the drag/drop operation is cancelled.
img = AxSftTree1.Items.ItemImageLeaf End If End If Dim sendingImage As Image = OLECvt.ToImage(img.Picture) Data.SetData(DataFormats.Bitmap, True, sendingImage) DoDragDrop(Data, DragDropEffects.Copy) End Sub Private Sub AxSftTree1_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_OLEStartDragEvent) Handles AxSftTree1.OLEStartDrag ' This section demonstrates drag&drop) using OLE mechanisms built into this control ' THIS CODE IS ONLY USED IF DRAGMETHOD IS SET TO ( 3 - OLEDrag ) or SftTreeDragMethodConstants.dragSftTreeOLE Dim curr As Integer curr = AxSftTree1.Items.Current
DropTarget.Caption = Data.GetData(vbCFText) End If If Data.GetFormat(vbCFDIB) Then Set DropTargetPic.Picture = Data.GetData(vbCFDIB) End If End Sub Private Sub SftTree1_OLEStartDrag(Data As SftTreeLib75.DataObject, AllowedEffects As Long) Dim curr As Integer curr = SftTree1.Items.Current ' cell text Data.SetData SftTree1.Cell(curr, 0).Text, vbCFText ' item picture If SftTree1.Item(curr).Image.Type = sftTypeIDispatch Then Data.SetData SftTree1.Item(curr).Image.Picture, vbCFDIB
else img = axSftTree1.Items.ItemImageLeaf; } Image sendingImage = OLECvt.ToImage(img.Picture); data.SetData(DataFormats.Bitmap, true, sendingImage); DoDragDrop(data, DragDropEffects.Copy); } private void axSftTree1_OLEStartDrag(object sender, AxSftTreeLib75._DSftTreeEvents_OLEStartDragEvent e) { // This section demonstrates drag&drop) using OLE mechanisms built into this control // THIS CODE IS ONLY USED IF DRAGMETHOD IS SET TO ( 3 - OLEDrag ) or SftTreeDragMethodConstants.dragSftTreeOLE int curr = axSftTree1.Items.Current; // cell text e.data.SetData(axSftTree1.get_Cell(curr, 0).Text, SftOLEClipboardConstants.sftCFText);
// The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CDragDropDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CDragDropDlg::OnOLEStartDragSftTree1(LPDISPATCH FAR* Data, long FAR* AllowedEffects) { IVDMDataObjectPtr pDataObject = *Data; ASSERT(pDataObject != NULL); long curr = m_vTree->Items->Current; // cell text pDataObject->SetData(_variant_t(m_vTree->Cell[curr][0]->Text), _variant_t((short)sftCFText)); // item picture
See Also SftTree Object | Object Hierarchy