SftTree/OCX 7.5 - ActiveX Tree Control


HorizontalExtentPix Property, SftTreeItems Object

Defines the current horizontal scrolling extent.



VB.NETExtentPix = object.HorizontalExtentPix As Integer
VBExtentPix = object.HorizontalExtentPix As Long
C#.NETint ExtentPix = object.HorizontalExtentPix;
VC++long ExtentPix = object->HorizontalExtentPix;
long ExtentPix = object->GetHorizontalExtentPix();
CHRESULT object->get_HorizontalExtentPix(long* ExtentPix);


VB.NETobject.HorizontalExtentPix = ExtentPix As Integer
VBobject.HorizontalExtentPix = ExtentPix As Long
C#.NETint object.HorizontalExtentPix = ExtentPix;
VC++long object->HorizontalExtentPix = ExtentPix;
void object->PutHorizontalExtentPix(long ExtentPix);
CHRESULT object->put_HorizontalExtentPix(long ExtentPix);


A SftTreeItems object.


Defines the current horizontal scrolling extent in pixels. If this value is 0 (or less than the width of the tree control), horizontal scrolling is disabled.


The HorizontalExtentPix property defines the current horizontal scrolling extent.

The Items.HorizontalExtent and HorizontalExtentPix methods are synonyms, but may use different coordinate systems.

A tree control's displayable area can be wider than the tree control's window width. If the displayable area is wider, the tree control can be scrolled horizontally if it has a horizontal scroll bar (see Scrollbars property). The width of the displayable area can be set by the application using the Items.RecalcHorizontalExtent method or the Items.HorizontalExtent property. For performance reasons, the optimal width is not automatically calculated when adding items to a tree control.

The width Extent set using this property must be equal to or greater than the combined column widths plus the width returned by the ColumnsObj.OverheadWidth property.

The Items.HorizontalExtent property defines the horizontal extent of the displayable area (or the left pane of a split tree control).

The Items.HorizontalExtent2 property defines the horizontal extent of the displayable area in the right pane of a split tree control. The Items.HorizontalExtent2 property can only be used with a split tree control.

If the width set is smaller than the actual window width, the control cannot be scrolled horizontally. The horizontal scroll bar will be disabled or hidden, based on the Scrollbars property.

By default, a tree control does not handle horizontal scrolling, even if the Scrollbars property defines scroll bars to be available. To start horizontal scrolling, an application has to use the Items.RecalcHorizontalExtent method or the Items.HorizontalExtent property. They indicate to the tree control that horizontal scrolling support is desired and allows it to determine the horizontal scrolling extent.

The tree control doesn't automatically update the horizontal extent when items are added or deleted or other methods or properties are used, which may invalidate the horizontal extent. The Items.RecalcHorizontalExtent method or Items.HorizontalExtent property have to be used again to recalculate or redefine the extent.



            Dim O As Object = e.Data.GetData(DataFormats.Bitmap, True)
            DropTargetPic.Image = O
        End If
    End Sub

    Private Sub AxSftTree1_OLEDragDrop(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_OLEDragDropEvent) Handles AxSftTree1.OLEDragDrop
        ' get horizontal extent and width of column 0
        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


                object o = e.Data.GetData(DataFormats.Bitmap, true);
                DropTargetPic.Image = (Image) o;

        private void axSftTree1_OLEDragDrop(object sender, AxSftTreeLib75._DSftTreeEvents_OLEDragDropEvent e) {

            // get horizontal extent and width of column 0
            int horzExtent = axSftTree1.Items.HorizontalExtentPix;
            int firstColumnWidth = axSftTree1.get_Column(0).WidthPix;

            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);



void CDragDropDlg::OnOLEDragDropSftTree(LPDISPATCH FAR* Data, long FAR* Effect, short FAR* Button, short FAR* Shift, float FAR* x, float FAR* y)
    IVDMDataObjectPtr pDataObject = *Data;
    ASSERT(pDataObject != NULL);

    // 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;

See Also SftTreeItems Object | Object Hierarchy

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