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
Source object is starting an OLE drag & drop operation.
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 containing formats that the source will provide and, in addition, possibly the data for those formats. If no data is contained in the DataObject, it is provided when the control calls the GetData method and you should provide the values for the Data parameter.
AllowedEffects
A Long variable set by the source object identifying all effects it supports. This parameter must be correctly set by the target component during this event. The value of Effect is determined by logically Or'ing together all active effects. The target component should check these effects and other parameters to determine which actions are appropriate for it, and then set this parameter to one of the allowable effects (as specified by the source) to specify which actions will be performed if the user drops the selection on the component.
AllowedEffects | 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 source object is starting an OLE drag & drop operation.
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 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 using SetData, the drag & drop operation is cancelled.
AllowedEffects must be set to vbDropEffectCopy or vbDropEffectMove, otherwise the drag & drop operation is cancelled.
Private Sub AxSftDirectory1_DragStarting(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_DragStartingEvent) Handles AxSftDirectory1.DragStarting Dim F As SftDirectoryFolder F = AxSftDirectory1.CurrentFolder If Not F Is Nothing Then AxSftDirectory1.OLEDrag(False, True, -1, -1) End If End Sub Private Sub AxSftDirectory1_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLEStartDragEvent) Handles AxSftDirectory1.OLEStartDrag e.data.Clear() e.data.SetData(Nothing, SftOLEClipboardConstants.sftCFText) e.allowedEffects = 1 'vbDropEffectCopy End Sub Private Sub AxSftDirectory1_OLESetData(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLESetDataEvent) Handles AxSftDirectory1.OLESetData If e.format = SftOLEClipboardConstants.sftCFText Then
ByVal xPos As Single, ByVal yPos As Single) Dim F As SftDirectoryFolder Set F = SftDirectory1.CurrentFolder If Not F Is Nothing Then SftDirectory1.OLEDrag False, True, -1, -1 End If End Sub Private Sub SftDirectory1_OLEStartDrag(Data As SftDirectoryLib30.DataObject, _ AllowedEffects As Long) Data.Clear Data.SetData , sftCFText AllowedEffects = vbDropEffectCopy End Sub Private Sub SftDirectory1_OLESetData(Data As SftDirectoryLib30.DataObject, Format As Integer)
{ SftDirectoryFolder f; f = axSftDirectory1.CurrentFolder; if (f != null) { axSftDirectory1.OLEDrag(false, true, -1, -1); } } private void axSftDirectory1_OLEStartDrag(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_OLEStartDragEvent e) { e.data.Clear(); e.data.SetData(null, SftOLEClipboardConstants.sftCFText); e.allowedEffects = 1; //vbDropEffectCopy } private void axSftDirectory1_OLESetData(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_OLESetDataEvent e)
HCURSOR COLEDragDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } BEGIN_EVENTSINK_MAP(COLEDragDlg, CDialog) //{{AFX_EVENTSINK_MAP(COLEDragDlg) ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 4 /* DragStarting */, OnDragStartingSftDirectory1, VTS_I2 VTS_I2 VTS_I4 VTS_I4) ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 35 /* OLEStartDrag */, OnOLEStartDragSftDirectory1, VTS_PDISPATCH VTS_PI4) ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 34 /* OLESetData */, OnOLESetDataSftDirectory1, VTS_PDISPATCH VTS_PI2) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() BOOL COLEDragDlg::OnInitDialog() { CDialog::OnInitDialog();
See Also SftDirectory Object | Object Hierarchy