SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Adds a supported format and possibly its data to a DataObject object.
VB.NET | object.SetData([ ByVal Data As Object ] , [ ByVal Format As Object ] ) |
VB | object.SetData([ ByVal Data As Variant ] , [ ByVal Format As Variant ] ) |
C#.NET | void object.SetData(object Data, object Format); |
VC++ | HRESULT object->SetData(const _variant_t& Data = vtMissing, const _variant_t& Format = vtMissing); |
C | HRESULT object->raw_SetData(VARIANT Data, VARIANT Format); |
object
Data
The data to be passed to the DataObject object. The Data argument is optional.
Format
The data format (see SftOLEClipboardConstants). The Format argument is optional.
Format | Value | Description |
---|---|---|
sftCFText | 1 | Text (as a String value) |
sftCFBitmap | 2 | Bitmap (as Picture object) |
sftCFMetafile | 3 | Metafile (as Picture object) |
sftCFDIB | 8 | Device independent bitmap (as Picture object) |
sftCFFiles | 15 | List of files. SetData cannot be used to supply data for this format. Use the DataObject.Files collection instead. |
sftCFRTF | -16639 | Rich text format (as String value) |
The SetData method adds a supported format and possibly its data to a DataObject object.
The Data argument is optional. This allows you to set several different formats that the source component can support without having to load the data separately for each format. Multiple formats are set by calling SetData several times, each time using a different format. If you wish to start fresh, use the DataObject.Clear method to clear all data and format information from the DataObject.
The Format argument is also optional, but either the Data or Format argument must be specified. If Data is specified, but not Format, the format of the data is determined automatically. If this is unsuccessful, then an error is generated. When the target requests the data and a format was specified, but no data was provided, the source's OLESetData event occurs, and the source can then provide the requested data type.
It is possible for the DataObject.GetData method and SetData method to use data formats other than those listed as valid Format argument, including user-defined formats registered with Windows via the RegisterClipboardFormat() API function. The SetData method requires the data to be in the form of a byte array when it does not recognize the data format specified. The DataObject.GetData method always returns data in a byte array when it is in a format that it doesn't recognize, although this may be transparently converted into other data types, such as strings. The byte array returned by DataObject.GetData will be larger than the actual data when running on some operating systems, with arbitrary bytes at the end of the array. This allocation of memory is often larger than is actually required for the data. Therefore, there may be extraneous bytes near the end of the allocated memory segment.
Private Sub comboSource_DragStarting(ByVal sender As Object, ByVal e As AxSftBoxLib50._ISftBoxEvents_DragStartingEvent) Handles comboSource.DragStarting comboSource.OLEDrag() End Sub Private Sub comboSource_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftBoxLib50._ISftBoxEvents_OLEStartDragEvent) Handles comboSource.OLEStartDrag e.allowedEffects = vbDropEffectCopy Or vbDropEffectMove Dim textData As String = comboSource.get_Cell(comboSource.Items.Selection, 0).Text e.data.SetData(textData, SftOLEClipboardConstants.sftCFText) End Sub Private Sub comboTarget_OLEDragOver(ByVal sender As Object, ByVal e As AxSftBoxLib50._ISftBoxEvents_OLEDragOverEvent) Handles comboTarget.OLEDragOver If e.state = SftBoxOLEDragOverConstants.enterSftBox Then ' Show the drop down portion comboTarget.DropDown.Dropped = True ElseIf e.state = SftBoxOLEDragOverConstants.leaveSftBox Then ' Hide the drop down portion with a delay, in case the
End Sub Private Sub ComboSource_DragStarting(ByVal Part As SftBoxLib50.SftBoxPortionConstants, ByVal Button As Integer, ByVal Shift As Integer, ByVal xPos As Single, ByVal yPos As Single) ComboSource.OLEDrag End Sub Private Sub ComboSource_OLEStartDrag(Data As SftBoxLib50.DataObject, AllowedEffects As Long) AllowedEffects = vbDropEffectCopy Or vbDropEffectMove Data.SetData ComboSource.Cell(ComboSource.Items.Selection, 0).Text, sftCFText End Sub Private Sub Command1_Click() Unload Form1 End Sub Private Sub Form_Load()
{ comboSource.OLEDrag(); } private void comboSource_OLEStartDrag(object sender, AxSftBoxLib50._ISftBoxEvents_OLEStartDragEvent e) { e.allowedEffects = vbDropEffectCopy | vbDropEffectMove; string textData = comboSource.get_Cell(comboSource.Items.Selection, 0).Text; e.data.SetData(textData, SftOLEClipboardConstants.sftCFText); } private void comboTarget_OLEDragOver(object sender, AxSftBoxLib50._ISftBoxEvents_OLEDragOverEvent e) { if (e.state == SftBoxOLEDragOverConstants.enterSftBox) { // Show the drop down portion comboTarget.DropDown.Dropped = true;
See Also DataObject Object | Object Hierarchy