Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

DataObject.GetFormat Method

Determines if a specified clipboard format is supported by the DataObject object.

Syntax

VB.NETFormatSupported = object.GetFormat(ByVal Format As Short) As Boolean
VBFormatSupported = object.GetFormat(ByVal Format As Integer) As Boolean
C#.NETbool FormatSupported = object.GetFormat(short Format);
VC++VARIANT_BOOL FormatSupported = object->GetFormat(short Format);
CHRESULT object->raw_GetFormat(short Format, VARIANT_BOOL* FormatSupported);

object

A DataObject object.

Format

The data format requested (see SftOLEClipboardConstants).

FormatValueDescription
sftCFText1Text
sftCFBitmap2Bitmap
sftCFMetafile3Metafile
sftCFDIB8Device independent bitmap
sftCFFiles15List of files
sftCFRTF-16639Rich text format

FormatSupported

Returns True if the specified clipboard format Format is supported by the DataObject object, otherwise False is returned.

Comments

The GetFormat method determines if a specified clipboard format is supported by the DataObject object.

The GetFormat method returns True if a data format in the DataObject object matches the specified format. Otherwise, it returns False.

Examples

VB.NET

    ElseIf e.state = SftBoxOLEDragOverConstants.leaveSftBox Then
        ' Hide the drop down portion with a delay, in case the
        ' user is moving from/to the static or drop down portion
        comboTarget.DropDown.RollUp(500)  ' 1/2 second
    End If
End Sub

Private Sub comboTarget_OLEDragDrop(ByVal sender As Object, ByVal e As AxSftBoxLib50._ISftBoxEvents_OLEDragDropEvent) Handles comboTarget.OLEDragDrop
    If e.data.GetFormat(SftOLEClipboardConstants.sftCFText) Then
        Dim itemIndex As Integer
        itemIndex = comboTarget.Items.Insert(e.data.GetData(SftOLEClipboardConstants.sftCFText), comboTarget.Items.DropIndex)
        comboTarget.Items.Selection = itemIndex
    End If
    If e.data.GetFormat(SftOLEClipboardConstants.sftCFBitmap) Then
        Dim itemIndex As Integer
        itemIndex = comboTarget.Items.Insert("A Bitmap", comboTarget.Items.DropIndex)

VB6

        ' Hide the drop down portion with a delay, in case the
        ' user is moving from/to the static or drop down portion
        ComboTarget.DropDown.RollUp 500  ' 1/2 second
    End If
End Sub

Private Sub ComboTarget_OLEDragDrop(Data As SftBoxLib50.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim ItemIndex As Long
    If Data.GetFormat(sftCFText) Then
        ItemIndex = ComboTarget.Items.Insert(Data.GetData(sftCFText), ComboTarget.Items.DropIndex)
        ComboTarget.Items.Selection = ItemIndex
    End If
    If Data.GetFormat(sftCFDIB) Then
        ItemIndex = ComboTarget.Items.Insert("A Bitmap", ComboTarget.Items.DropIndex)
        Set ComboTarget.Item(ItemIndex).Image.Picture = Data.GetData(sftCFDIB)
        ComboTarget.Items.Selection = ItemIndex

C#

        // Hide the drop down portion with a delay, in case the
        // user is moving from/to the static or drop down portion
        comboTarget.DropDown.RollUp(500);  // 1/2 second
    }
}

private void comboTarget_OLEDragDrop(object sender, AxSftBoxLib50._ISftBoxEvents_OLEDragDropEvent e)
{
    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFText)) {
        int itemIndex = comboTarget.Items.Insert(e.data.GetData(SftOLEClipboardConstants.sftCFText) as string, comboTarget.Items.DropIndex);
        comboTarget.Items.Selection = itemIndex;
    }
    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFBitmap)) {
        int itemIndex = comboTarget.Items.Insert("A Bitmap", comboTarget.Items.DropIndex);
        object o = e.data.GetData(SftOLEClipboardConstants.sftCFBitmap);
        comboTarget.get_Item(itemIndex).Image.Picture = o as stdole.IPictureDisp;

See Also DataObject Object | Object Hierarchy


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