Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

GetFormat Method, DataObject Object

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

        Dim horzExtent As Integer
        horzExtent = AxSftTree1.Items.HorizontalExtentPix
        Dim firstColumnWidth As Integer
        firstColumnWidth = AxSftTree1.get_Column(0).WidthPix

        Dim insertAt As Integer
        insertAt = AxSftTree1.Items.DropHighlight
        If insertAt < 0 Then Exit Sub
        If e.data.GetFormat(SftOLEClipboardConstants.sftCFText) Then
            Dim lvl As Integer
            lvl = AxSftTree1.get_Item(insertAt).Level
            Dim str As String
            str = e.data.GetData(SftOLEClipboardConstants.sftCFText)
            Dim newItem As Integer
            newItem = AxSftTree1.Items.Insert(insertAt + 1, str)
            AxSftTree1.get_Item(newItem).Level = lvl + 1

VB6

    ' get horizontal extent and width of column 0
    horzExtent = SftTree1.Items.HorizontalExtent
    col0Width = SftTree1.Column(0).Width

    insertAt = SftTree1.Items.DropHighlight
    If insertAt < 0 Then Exit Sub

    If Data.GetFormat(vbCFText) Then
        lvl = SftTree1.Item(insertAt).Level
        str = Data.GetData(vbCFText)
        newItem = SftTree1.Items.Insert(insertAt + 1, str)
        SftTree1.Item(newItem).Level = lvl + 1
    ElseIf Data.GetFormat(vbCFDIB) Then
        Set SftTree1.Cell(insertAt, 0).Image.Picture = Data.GetData(vbCFDIB)
        SftTree1.Cell(insertAt, 0).ImageHAlign = halignSftTreeRight
    ElseIf Data.GetFormat(vbCFFiles) Then

C#

            int insertAt = axSftTree1.Items.DropHighlight;
            if (insertAt < 0) return;
            if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFText)) {
                short lvl = axSftTree1.get_Item(insertAt).Level;
                string str = (string) e.data.GetData(SftOLEClipboardConstants.sftCFText);
                int newItem = axSftTree1.Items.Insert(insertAt + 1, str);
                axSftTree1.get_Item(newItem).Level = (short) (lvl + 1);
            }
            if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFDIB)) {
                axSftTree1.get_Cell(insertAt, 0).Image.Picture = (stdole.IPictureDisp)e.data.GetData((short) SftOLEClipboardConstants.sftCFDIB);
                axSftTree1.get_Cell(insertAt, 0).ImageHAlign = SftTreeHAlignConstants.halignSftTreeRight;
            }
            if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFBitmap)) {
                axSftTree1.get_Cell(insertAt, 0).Image.Picture = (stdole.IPictureDisp)e.data.GetData((short) SftOLEClipboardConstants.sftCFBitmap);
                axSftTree1.get_Cell(insertAt, 0).ImageHAlign = SftTreeHAlignConstants.halignSftTreeRight;
            }

C++

    // get horizontal extent and width of column 0
    long horzExtent = m_vTree->Items->HorizontalExtentPix;
    long col0Width = m_vTree->Column[0]->WidthPix;

    long insertAt = m_vTree->Items->DropHighlight;
    if (insertAt < 0) return;

    if (pDataObject->GetFormat(sftCFText) != VARIANT_FALSE) {
        int lvl = m_vTree->Item[insertAt]->Level;
        _variant_t object = pDataObject->GetData((short)sftCFText);
        _bstr_t astring = object;
        long newItem = m_vTree->Items->Insert(insertAt + 1, astring);
        m_vTree->Item[newItem]->Level = lvl + 1;
    } else if (pDataObject->GetFormat(sftCFDIB)) {
        _variant_t object = pDataObject->GetData((short)sftCFDIB);
        IPictureDispPtr pPicDisp = object;

See Also DataObject Object | Object Hierarchy


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