Source object is starting an OLE drag & drop operation.
| C# | void object_OLEStartDrag(object sender, EventArgumentType e); |
| VB.NET | Private Sub object_OLEStartDrag(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.OLEStartDrag |
| C++ | 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 source component during this event. The value of AllowedEffects is determined by logically Or'ing together all supported effects. The target component can check these effects and other parameters to determine which actions are appropriate for it.
| 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 target. The drag source should remove the data from itself after the move. |
Note: The constants vbDropEffectNone, etc. are not predefined and have to be defined explicitly by the application.
The OLEStartDrag event occurs when the 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 void axSftMask1_DragStarting(object sender, AxSftMaskLib80._ISftMaskEvents_DragStartingEvent e) { if (axSftMask1.SelLength != 0) { axSftMask1.OLEDrag(); } } private void axSftMask1_OLEStartDrag(object sender, AxSftMaskLib80._ISftMaskEvents_OLEStartDragEvent e) { e.data.Clear(); e.data.Files.Add(axSftMask1.SelText, null); e.data.SetData(null, SftOLEClipboardConstants.sftCFFiles); e.allowedEffects = 1; //vbDropEffectCopy }
End Sub Private Sub AxAxSftMask1_DragStarting(ByVal sender As Object, ByVal e As AxSftMaskLib80._ISftMaskEvents_DragStartingEvent) Handles AxSftMask1.DragStarting If AxSftMask1.SelLength <> 0 Then AxSftMask1.OLEDrag() End If End Sub Private Sub AxAxSftMask1_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftMaskLib80._ISftMaskEvents_OLEStartDragEvent) Handles AxSftMask1.OLEStartDrag e.data.Clear() e.data.Files.Add(AxSftMask1.SelText) e.data.SetData(Nothing, SftOLEClipboardConstants.sftCFFiles) e.allowedEffects = 1 ' vbDropEffectCopy End Sub
void CProject1Dlg::OnDragStartingSftMask1(short Button, short Shift, float x, float y) { if (m_pMask1->SelLength != 0) { m_pMask1->OLEDrag(); } } void CProject1Dlg::OnOLEStartDragSftMask1(LPDISPATCH FAR* Data, long FAR* AllowedEffects) { IVDMDataObjectPtr pData = *Data; pData->Clear(); pData->Files->Add(m_pMask1->SelText); pData->SetData(vtMissing, _variant_t((long) sftCFFiles)); *AllowedEffects = DROPEFFECT_COPY; }
See Also SftMask Events | Object Hierarchy