Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectory.OLEDropMode Property

Defines OLE drop support.

Syntax

Get

VB.NETMode = object.OLEDropMode As SftControlOLEDropModeConstants
VBMode = object.OLEDropMode As SftControlOLEDropModeConstants
C#.NETSftControlOLEDropModeConstants Mode = object.OLEDropMode;
VC++enum SftControlOLEDropModeConstants Mode = object->OLEDropMode;
enum SftControlOLEDropModeConstants Mode = object->GetOLEDropMode();
CHRESULT object->get_OLEDropMode(enum SftControlOLEDropModeConstants* Mode);

Put

VB.NETobject.OLEDropMode = Mode As SftControlOLEDropModeConstants
VBobject.OLEDropMode = Mode As SftControlOLEDropModeConstants
C#.NETSftControlOLEDropModeConstants object.OLEDropMode = Mode;
VC++enum SftControlOLEDropModeConstants object->OLEDropMode = Mode;
void object->PutOLEDropMode(enum SftControlOLEDropModeConstants Mode);
CHRESULT object->put_OLEDropMode(enum SftControlOLEDropModeConstants Mode);

object

A SftDirectory object.

Mode

Defines whether the control can act as an OLE drop target.

ModeValueDescription
OLEDropSftControlNone0The control is not a valid drop target.
OLEDropSftControlManual1The control is a valid drop target and triggers the OLE drop events, allowing the application to handle the OLE drop operation.
OLEDropSftControlAutomatic2The control is a valid drop target and automatically accepts the data dropped on the control.

Comments

The OLEDropMode property defines OLE drop support.

If the control is a valid drop target (OLEDropSftControlManual), the events OLEDragOver and OLEDragDrop occur when an item is dragged over the control or when an item is dropped.

Examples

VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftDirectory1.OLEDropMode = SftControlOLEDropModeConstants.OLEDropSftControlManual
    AxSftDirectory1.AutoExpandDragDrop = True
End Sub

Private Sub AxSftDirectory1_OLEDragDrop(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLEDragDropEvent) Handles AxSftDirectory1.OLEDragDrop
    ' make sure the control doesn't perform its usual default handling of
    ' the files (copy/move, etc.)
    e.defaultHandling = False

    If e.data.GetFormat(SftOLEClipboardConstants.sftCFFiles) Then
        Dim I As Integer
        For I = 1 To e.data.Files.Count
            MessageBox.Show("""" & e.data.Files(I) & """ being dropped.")
            ' perform your own processing here
        Next

VB6

Private Sub Form_Load()
    SftDirectory1.OLEDropMode = OLEDropSftControlManual
    SftDirectory1.AutoExpandDragDrop = True
End Sub

Private Sub SftDirectory1_OLEDragDrop(Data As SftDirectoryLib30.DataObject, _
        Folder As SftDirectoryLib30.ISftDirectoryFolder, Effect As Long, _
        Button As Integer, Shift As Integer, x As Single, y As Single, _
        DefaultHandling As Boolean)
    If Data.GetFormat(sftCFFiles) Then
        For i = 1 To Data.Files.Count
            MsgBox ("""" & Data.Files.Item(i) & """ being dropped.")
            ' perform your own processing here
        Next
    Else
        ' some other format

C#

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftDirectory1.OLEDropMode = SftControlOLEDropModeConstants.OLEDropSftControlManual;
    axSftDirectory1.AutoExpandDragDrop = true;
}

private void axSftDirectory1_OLEDragDrop(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_OLEDragDropEvent e)
{
    // make sure the control doesn't perform its usual default handling of
    // the files (copy/move, etc.)
    e.defaultHandling = false;

    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFFiles)) {
        for (int i = 0 ; i < e.data.Files.Count ; ++i) {
            MessageBox.Show("\"" + e.data.Files[i+1] + "\" being dropped.");
            // perform your own processing here

C++

{
    CDialog::OnInitDialog();

    SetIcon(m_hIcon, TRUE);            // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon

    m_vDir1 = m_Dir1.GetControlUnknown();

    m_vDir1->OLEDropMode = OLEDropSftControlManual;
    m_vDir1->AutoExpandDragDrop = VARIANT_TRUE;
    return TRUE;
}

void COLEDragDlg::OnOLEDragDropSftDirectory1(LPDISPATCH FAR* Data, LPDISPATCH FAR* Folder, long FAR* Effect, short FAR* Button, short FAR* Shift, float FAR* x, float FAR* y, BOOL FAR* DefaultHandling)
{
    IVDMDataObjectPtr pData(*Data);

See Also SftDirectory Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.