HeaderPane
Main
Hide

SftTree/OCX 8.0 - ActiveX Tree Control

Share Link
Print

AttachContentWindow Method, SftTreeCell Object

Attaches a content window to the cell.

Syntax

VB.NETobject.AttachContentWindow(ByVal Window As Integer, ByVal Style As SftTreeContentWindowStyleConstants)
VBobject.AttachContentWindow(ByVal Window As OLE_HANDLE, ByVal Style As SftTreeContentWindowStyleConstants)
C#.NETvoid object.AttachContentWindow(int Window, SftTreeContentWindowStyleConstants Style);
VC++HRESULT object->AttachContentWindow(OLE_HANDLE Window, enum SftTreeContentWindowStyleConstants Style);
CHRESULT object->raw_AttachContentWindow(OLE_HANDLE Window, enum SftTreeContentWindowStyleConstants Style);

object

A SftTreeCell object.

Window

The window handle of the window to use for the cell as a content window. Specify NULL/Nothing to clear the cell's content window, so the cell's regular contents are shown instead.

Style

Defines options for the content window. Values of the following tables can be combined and used as Style value:

NameValueDescription
contentWindowSftTreeNone0None - No special handling.
contentWindowSftTreeKeepDisabled1Keep Disabled - The content window is always disabled. A content window is normally enabled and disabled as it is made visible or hidden. When contentWindowSftTreeKeepDisabled is specified, the content window is always disabled, even when it is visible.
contentWindowSftTreeKeepSize2Keep Size (Variable Height Tree Control) - The original size of the content window is preserved and the cell size adjusts accordingly. While a column can still be smaller or larger than the content window width, the content window is not resized, it is merely clipped. Without contentWindowSftTreeKeepSize, a content window is resized in height and width to fit within the cell. contentWindowSftTreeKeepSize has no effect in a fixed height tree control.

Comments

The AttachContentWindow method attaches a content window to the cell.

If a content window is attached to a cell, the cell's regular contents (e.g., Cell.Text) are not shown.

The Cell.GetContentWindow method can be used to retrieve a cell's current content window settings.

Examples

VB.NET

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftTree1.DarkMode = SftTreeLib80.SftTreeDarkModeConstants.darkSftTreeAuto
    AxSftTree1.HighContrastMode = SftTreeLib80.SftTreeHighContrastConstants.highContrastSftTreeAuto
    Dim path As String = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(Application.ExecutablePath)))
    ' Windows Media Player
    AxWindowsMediaPlayer1.URL = path + "\\intermission.wmv"
    AxSftTree1.get_Item(4).Cell(1).AttachContentWindow(AxWindowsMediaPlayer1.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeKeepSize)
    AxSftTree1.get_Item(4).Cell(1).Text = ""

    ' Web Browser
    webBrowser1.Navigate("https://www.softelvdm.com")
    Dim Item As SftTreeItem = AxSftTree1.get_Item(5)
    Dim Cell As SftTreeCell = Item.Cell(1)
    Cell.AttachContentWindow(webBrowserPanel.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeNone)

VB6

Private Sub Form_Load()
    
    ' Flash
    ' Because some controls don't have a window handle property (like hWnd),
    ' we place the control inside a picturebox. A picturebox has a window
    ' handle property hWnd.
    ShockwaveFlash1.Movie = App.Path & "\header.swf"
    SftTree1.Item(3).Cell(1).AttachContentWindow FlashPictureBox.hWnd, contentWindowSftTreeKeepSize
    SftTree1.Item(3).Cell(1).Text = ""
    
    ' Windows Media Player
    WindowsMediaPlayer1.URL = App.Path & "\intermission.wmv"
    SftTree1.Item(4).Cell(1).AttachContentWindow WMPPictureBox.hWnd, contentWindowSftTreeKeepSize
    SftTree1.Item(4).Cell(1).Text = ""
    
    ' Web Browser

C#

            };
        }

        private void Form1_Load(object sender, EventArgs e) {

            String path = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(Application.ExecutablePath)));
            // Windows Media Player
            axWindowsMediaPlayer1.URL = path + "\\intermission.wmv";
            axSftTree1.get_Item(4).get_Cell(1).AttachContentWindow((int) axWindowsMediaPlayer1.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeKeepSize);
            axSftTree1.get_Item(4).get_Cell(1).Text = "";

            // Web Browser
            webBrowser1.Navigate("https://softelvdm.com");
            SftTreeItem Item= axSftTree1.get_Item(5);
            SftTreeCell Cell = Item.get_Cell(1);
            Cell.AttachContentWindow((int)webBrowserPanel.Handle, SftTreeContentWindowStyleConstants.contentWindowSftTreeNone);

C++

    // Windows Media Player

    // Create the dialog containing the Windows Media Player control
    if (!m_WMPDialog.Create(IDD_WMP_DIALOG, &m_Tree) || !m_WMPDialog.HaveWMP()) {
         m_vTree->Item[4]->Cell[1]->Text = _T("Windows Media Player control could not be instantiated - maybe Windows Media Player is not installed\n\n")
                                  _T("Windows Media Player is available at www.microsoft.com.");
    } else {
         m_vTree->Item[4]->Cell[1]->Text = _T("");
         m_vTree->Item[4]->Cell[1]->AttachContentWindow((LONG_PTR) m_WMPDialog.m_hWnd, contentWindowSftTreeKeepSize);
    }

    // Internet Explorer

    // Create the dialog containing the web browser control
    if (!m_IEDialog.Create(IDD_IE_DIALOG, &m_Tree) || !m_IEDialog.HaveWebBrowser()) {
         m_vTree->Item[5]->Cell[1]->Text = _T("Internet Explorer control could not be instantiated - maybe Internet Explorer is not installed\n\n")

See Also SftTreeCell Object | Object Hierarchy


Last Updated 05/24/2026 - (email)
© 2026 Softel vdm, Inc.