property Items.CellPicture ([Item as Variant], [ColIndex as Variant]) as Variant
Retrieves or sets a value that indicates the Picture object displayed by the cell.

TypeDescription
Item as Variant A long expression that indicates the item's handle.
ColIndex as Variant A long expression that indicates the column's index, a string expression that indicates the column's caption or the column's key.
Variant A Picture object that indicates the cell's picture. ( A Picture object implements IPicture interface ), a string expression that indicates the base64 encoded string that holds a picture object. Use the eximages tool to save your picture as base64 encoded format.  

The control can associate to a cell a check or radio button, an icon, multiple icons, a  picture and a caption. Use the CellPicture property  to associate a picture to a cell. You can use the CellPicture property when you want to display images with different widths into a cell. Use the CellImage property to associate an icon from Images collection. Use the CellImages property to assign multiple icons to a cell. Use the CellHasCheckBox property to add a check box to a cell. Use the CellHasRadioButton property to assign a radio button to a cell. The CellPictureWidth and CellPictureHeight properties specifies the size of the area where the cell's picture is stretched.

The following VB sample loads a picture from a file:

Tree1.Items.CellPicture(h, 0) = LoadPicture("c:\winnt\logo.gif")

The following VB sample associates a picture to a cell by loading it from a base64 encoded string:

Dim s As String
s = "gBCJr+BAAg0HGwEgwog4jg4ig4BAEFg4AZEKisZjUbAAzg5mg6Zg7Mg7/g0ek8oGcgjsijskjsmAEsmcoM0sM0uM0wM0ylwATMoTMsTMuTMwTMymAAZkoZksZkuZkwZkymQAf8of8sf8uf8wf8mlEdskekEekUekkesUqGcet9nGdpGdrGdilkruE3js5vtrnstk9BltnosttdJl8npsvs9Rl9rqsxk9ZmNnrsxtdhmcfskg0FAzskkEmM02t810Fzmuku8znGn2Ggv030mBv0zwk50GHnOkxU7g07s1PmeQnekyeBmeWnugzM90mcn9p0UgkXZpmik2EoGpoPY1lBklB7tE2VD7F+oflwOHoGEovYw9F8uKo8Go9o41H7KpqAybFKAyykuwzKkvKzilrW7aQPK7aSJIkzGqY1Kmwe1imwk17jKY2SnwevynwkwLIKYwiowew6owkxUAKYxqpweyCpwkybJqYyyqwezKqwkzirrErDOu7IkJyIyysNSrLStYrMJteraDK2ti+K2kStwmwLMqwwiutKw6uwmxSvyoxqvtKyCvwmybOKwyywtKzKwwnN6OTxPM9T3Pk+z9P9AUDP5V0JQtDUPRFE0SAFFUbR1FAAa9JUnSlJlnSZo0xStJGtStI03UFJUvUdQmuVtKU/TdT1RSpoGvS5WVKa9U1lWdRVrTtWVBS9c1nWlI0vSlY09WVg18a9MgAEla0nWliUkABHjXYCDUzSVY2daFSoNaBHWnWZH1/blN1TY1"
s = s + "XgBadlDXdYSXRb9wWBclK2taF1gAI5HiPaN8oPdlNWbaF23KAwyWkNYyXxg9p3WNYjU/c1bWgABZoMiQS4YR984YNdpEeMgA2bgVtVHil0DVdY1CPhON44IGOI1XVPCPjl14RlmZ3XmZH3aWdYW1VF3DWMuWXXlw15PhlI3pgGJEfpGiZZgw1kTe1s0+g2Dalhmh6Pjgg5zrVx5/iV74bjGN41k9pCNl6D1dilKWDrGZ6ftmcZyNYAhKAGl7HemgoNs415XjI1XLmNm3sEho2jwdw4zmd+2+aFjFZVJWYpndf3xSPG2/koSWXW+I7JURZmtzO+XPe1K9RZ+S9HS1PllWfB9FiHEWZVBZWzeXdU32Fa973/SW34lr0nV1meH4/heb5/mWL4no+fUAAICA"
With Tree1
    .BeginUpdate
    .Columns.Add "Column 1"
    With .Items
        Dim h As HITEM
        h = .AddItem("Item 1")
        .CellPicture(h, 0) = s
        .ItemHeight(h) = 24
    End With
    .EndUpdate
End With

The following C++ loads a picture from a file:

#include 
BOOL LoadPicture( LPCTSTR szFileName, IPictureDisp** ppPictureDisp )
{
	BOOL bResult = FALSE;
	if ( szFileName )
	{
		OFSTRUCT of;
		HANDLE hFile = NULL;;
#ifdef _UNICODE
		USES_CONVERSION;
		if ( (hFile = (HANDLE)OpenFile( W2A(szFileName), &of, OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR )
#else
		if ( (hFile = (HANDLE)OpenFile( szFileName, &of, OF_READ | OF_SHARE_COMPAT)) != (HANDLE)HFILE_ERROR )
#endif
		{
			*ppPictureDisp = NULL;
			DWORD dwHighWord = NULL, dwSizeLow = GetFileSize( hFile, &dwHighWord );
			DWORD dwFileSize = dwSizeLow;
			HRESULT hResult = NULL;
			if ( HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize) )
				if ( void* pvData = GlobalLock( hGlobal ) )
				{
					DWORD dwReadBytes = NULL;
					BOOL bRead = ReadFile( hFile, pvData, dwFileSize, &dwReadBytes, NULL );
					GlobalUnlock( hGlobal );
					if ( bRead )
					{
						CComPtr spStream;
						_ASSERTE( dwFileSize == dwReadBytes );
						if ( SUCCEEDED( CreateStreamOnHGlobal( hGlobal, TRUE, &spStream) ) )
							if ( SUCCEEDED( hResult = OleLoadPicture( spStream, 0, FALSE, IID_IPictureDisp, (void**)ppPictureDisp ) ) )
								bResult = TRUE;
					}
				}
			CloseHandle( hFile );
		}
	}
	return bResult;
}

IPictureDisp* pPicture = NULL;
if ( LoadPicture( "c:\\winnt\\zapotec.bmp", &pPicture ) )
{
	COleVariant vtPicture;
	V_VT( &vtPicture ) = VT_DISPATCH;
	pPicture->QueryInterface( IID_IDispatch, (LPVOID*)&V_DISPATCH( &vtPicture ) );
	CItems items = m_tree.GetItems();
	items.SetCellPicture( COleVariant( items.GetFocusItem() ), COleVariant(long(0)), vtPicture );
	pPicture->Release();
}

The following VB.NET sample loads a picture from a file:

With AxTree1.Items
    .CellPicture(.FocusItem, 0) = IPDH.GetIPictureDisp(Image.FromFile("c:\winnt\zapotec.bmp"))
End With 

where the IPDH class is defined like follows:

Public Class IPDH
    Inherits System.Windows.Forms.AxHost

    Sub New()
        MyBase.New("")
    End Sub

    Public Shared Function GetIPictureDisp(ByVal image As Image) As Object
        GetIPictureDisp = AxHost.GetIPictureDispFromPicture(image)
    End Function

End Class

The following C# sample loads a picture from a file:

axTree1.Items.set_CellPicture(axTree1.Items.FocusItem, 0, IPDH.GetIPictureDisp(Image.FromFile("c:\\winnt\\zapotec.bmp")));

where the IPDH class is defined like follows:

internal class IPDH : System.Windows.Forms.AxHost
{
	public IPDH() : base("")
	{
	}

	public static object GetIPictureDisp(System.Drawing.Image image)
	{
		return System.Windows.Forms.AxHost.GetIPictureDispFromPicture( image );
	}
}

The following VFP sample loads a picture from a file:

with thisform.Tree1.Items
	.DefaultItem = .FocusItem
	.CellPicture( 0, 0 ) = LoadPicture("c:\winnt\zapotec.bmp")
endwith