Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

DragDrop3 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)
{
    string s;
    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFText)) {
        s = (string) e.data.GetData(SftOLEClipboardConstants.sftCFText);
        axSftMask1.SelStart = e.targetChar;
        axSftMask1.SelText = s;
    } else {
        e.effect = 0; //vbDropEffectNone
    }
}

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.sftCFText)) {
            // OK, we have a text format
        } else {
            // No text format
            e.effect = 0; //vbDropEffectNone
        }
    }
}

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