Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

DragDrop2 Sample (C#)

This sample illustrates using an OLE drop target.

This is not an executable sample, so a complete project is not provided. These statements are intended to show basic concepts and the syntax used.

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftMask1.Caption.SizePercent = 33;
    axSftMask1.Caption.Text = "&Filename:";
    axSftMask1.Mask = "";
    axSftMask1.MaxLength = 300;
    axSftMask1.PromptUnderline = false;
    axSftMask1.OLEDropMode = SftMaskOLEDropModeConstants.OLEDropSftMaskManual;
}

private void axSftMask1_OLEDragDrop(object sender, AxSftMaskLib70._ISftMaskEvents_OLEDragDropEvent e)
{
    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFFiles)) {
        if (e.data.Files.Count > 1)
            MessageBox.Show("Only one file at a time please.");
        else
            axSftMask1.Text = e.data.Files[1];
    }
}

private void axSftMask1_OLEDragOver(object sender, AxSftMaskLib70._ISftMaskEvents_OLEDragOverEvent e)
{
    if (e.targetChar < 0) {
        // Outside edit control (on caption)
        e.effect = 0; //vbDropEffectNone
    } else {
        // Inside edit control
        if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFFiles)) {
            // OK, we have a file format
        } else {
            // No file format
            e.effect = 0; //vbDropEffectNone
        }
    }
}

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