property Node.Picture as Variant
Retrieves or sets a graphic to be displayed in the node.

TypeDescription
Variant A VARIANT value that indicates the picture in the following formats:
  • A picture object being displayed in the node ( IPicture interface )
  • A safe array of bytes that indicates the OLE Object field. Use for OLE objects (such as Microsoft Word documents, Microsoft Excel spreadsheets, pictures, sounds, or other binary data) that were created in other programs using the OLE protocol.
  • A string expression that specifies the key of the picture being inserted using the HTMLPicture property
  • A string expression that indicates the picture's file path
  • A string expression that indicates the base64 encoded string that holds the picture. Use the eximages tool to save your icons as base64 encoded format. 

Use the Picture property to load an user defined picture to a node. Use the Image property to display a 16x16 icon in the node. Use the PictureAlignment property to align the picture in the node. Also, you can assign a picture to a node when calling Add method. Use the BackColor property to specify the node's background color. Use the Picture property to display a picture on the control's background. Use the Caption property to assign a caption to a node. You can insert custom sized pictures inside HTML captions using the <img> built-in HTML format. The Picture property supports: BMP,  EMF,  EXIF, GIF, ICON, JPEG, PNG, TIFF or WMF formats. The PictureWidth and PictureHeight properties controls the size of displayed picture. The PictureWidthNode and PictureHeightNode properties of the ChartView object handles the size of the displayed pictures for all the nodes.

If using the /NET assembly version, you can pass an System.Drawing.Image object to the Picture property like: .Nodes.Add("Child2", .Root, "21").Picture = PictureBox1.Image 

The size of the picture being shown in the node is computed as follow:

In any case, the size of the picture is also influenced by the the aspect ratio for the node's picture as it is specified by PictureAspectRatio or PictureAspectRatioNode property while any of these is not exAspectRatioNone.

The following VB sample loads icons and pictures using the BASE64 encoded strings:

Dim s As String
With ChartView1
    .BackColor = vbWhite
    
    .Images ("gBJJgBggAAwAAgACEKAD/hz/EMNh8TIRNGwAjEZAEXjAojJAjIgjIBAEijUlk8plUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDh+Dw1bwuJh0Sf8txeHyFXx+Ryk9wsnxbAzUpycYxWNiWMyujleXjOm0+gjKA1gA1iA0Wf0mz2WY1WwjWywuvz2N1GzyO11ON3mXxe6xfFzvAwXI1UY3mh5292PJ1vMw3T7Hbo3T73L7nhl3f5/i8034Xn9Xr9nt91Cio+lXyjsfkMjAEkk/69Hg97UpSeZ3pSeBnpScAHwO/iMmBBaMQalJAQc10JvylUJkAD8Dh+lJ8Q4k5/D+zjygAgI")
    
    With .Root
        .Image = 1
    End With
    
    With .Nodes.Add("Item 1")
        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"
        
        .Picture = s
    End With
    
    With .Nodes.Add("Item 2", , "ketA")
        s = "gBCJoqBAAg0HGwEgwog4qg4Xg4BAEFg4AegDisZjUbgwzg5mg6Zg7Mg7/jsHGceAAzkErkUrkkrkwAls0lRmlpml5mmJmmcvACZlSZlqZl6ZmKZmcxADMlTMlrMl7MmLMmczAD/lT/lr/l7/mL/k0qldlj0gj0ij0kj1jlUpj0ptAztQztgzsctllxnErnV+tk+l0doUutFGl1spUwjtOmFoqUwtlWmUdrUytFemVssU0j9lkGhoOekkgkxmm8pm2huk20t4mk51Gx0N/nGlwV/mmFnWhxE60uLnkGnlnqE0yM80uUwU0y8+0Oan2lztAtWjkEi7VN0cmwtB1VC7OtoUkoXeouzonZv9E82CxFBwtG7OIo3mxdIg1ItPHpDtKooLKMWoLLqU7LNKU8zOqYtjuJA8zuJIkiTMcprVKdCDWqdCbYOOprZqhCC/qhCbBMiprCqlCDEKlCbFwCprHKpCDIqpCbKMoprLqtCDNKtCbOqwsass870iwpIrLqy1StNM1qtQo2CuIMri2r6riRK5CjBM0rLCq80zEK9CjFrBKrHLA0zIrBCjKM6rLLrE0zNLFCk4I5PM9T3Pk+z9P9AUDQVAGua5Z0KVlCmuVho0VQxrmhQpZUOWZo0ia5o0SVtHU4a6DUPTlG0XQxZlmQNEmuVpWC6GVUUhQtDllTtFINRFRmua1UFmVhECsLpWFMQ5EAOGQZCuRFUFYVgZCtRlbUdWtXWBWFCi6A4AAOKwrEQLtsWILtTlaFYVgDZl"
        s = s + "XU5WtD2VbVlFZUwDAAGQD3La4yjIAADAOQQrAOFYc2IGRA1nTwAVgAASXGKwVi7fgADIR5EAAAIDhyR41CACt6ACVpHo9gNT3bWmC0gAJAhleADpUR5HjGR41kfhw15lh6JkQR+aWLZl2UvWpr0mA5EZkB18iOIwjjWIwgZkCoHgcI4jgrlYyAqI+MWxiYVgAPVUIMa1cYiNQy6eDgRg3p4gacI4DgcHIgagAwyamA4jDXsQ1iBYYSitngAa9WRZgAHWZaeBG6APuY1gQHIyaEA+mgeAGqbcI5HhkANm5Ea1G15ig1iCIAggOMt/gOCw12IB4ybQCvD9Xp+qjXeJS2hgprGhkwAgDxgg9j04vAcCoycUHIy9Pz+jh1pwOafa4ZV/kVCkDb2H5l0IEAcMvgez4g1cSDm3buBHXjWB1icxQqDFleIDlmRJHiOIIjg51o1gqCu0Ad/OoaL+O1bI0oMi8wVqnfQABUoKwGgAYq0p5YB2qP1acBUMr9n5NPaMEdtIa3GMwXNAVRahwvAGACBUNbT2qPLA4BwETjAdNPBEEBzr/ADgGAcIhbgKwYiBU2p9QoiBWizgCAFs7RYUOUEeAcMjywAgOAC0FyhK3DuHBWsxrxBlRKKfaAZtr9QDt3buxNiQaw1AHBYKwFgOXTgyEQIkWawwABWVArVUUV2gBrByACJjjF7glFYACDijIzAOAAolUqpFXM9UwooVgJQurdhsthmAKxTDXIcA4K0V5BqLFa39dDI1FDQUaDJr"
        s = s + "K7lDLYABKAaArVsisUuoWK6m1UKyYIpSVihRrPSlILKQi51OK6USqJUDIlSzBU4LNSKjVDytllIVSIiJiSKgKQE="
        
        .Picture = s
    End With
    
    With .Nodes.Add("Child", "ketA")
    End With
    
End With

Run the sample and you get:

The following two VB samples are equivalents:

With ChartView1
        With .Nodes
            With .Add("<r><dotline><b><fgcolor=0000FF>Andrew Fuller</fgcolor></b><br><solidline><b>Title</b>:<r><fgcolor=FF0000>Vice President Sales</fgcolor><br>USA, Tacoma, WA, 98401, 908 W. Capital Way<br><dotline><upline><b>Phone:</b><r>(206) 555-9482", , , 1, "c:\temp\sample\andrew.gif")
                .BackColor = vbWhite
            End With
        End With
End With

With ChartView1
        With .Nodes
            With .Add("<r><dotline><b><fgcolor=0000FF>Andrew Fuller</fgcolor></b><br><solidline><b>Title</b>:<r><fgcolor=FF0000>Vice President Sales</fgcolor><br>USA, Tacoma, WA, 98401, 908 W. Capital Way<br><dotline><upline><b>Phone:</b><r>(206) 555-9482", , , 1)
                .BackColor = vbWhite
                .Picture = "c:\temp\sample\andrew.gif"
            End With
        End With
    End With

I am wondering how to add a bitmap to a node without using an image list? Actually from a CBitmap that I already have. The idea is to get an IPicture object that displays that HBITMAP handle, so we have to use the OleCreatePictureIndirect API function that does the job. We can use the CPictureHolder class, already defined in the afxctl.h file, or we can use a direct function IPictureFromCBitmap as defined bellow.

  1. Using the CPictureHolder class
    #include <afxctl.h>
    CPictureHolder pict;
    if ( pict.CreateFromBitmap( (HBITMAP)bitmap.Detach() ) )
    {
    	COleVariant vtPicture;
    	V_VT( &vtPicture ) = VT_DISPATCH;
    	(V_DISPATCH( &vtPicture ) = pict.GetPictureDispatch() )->AddRef();
    	node.SetPicture( vtPicture );
    }
  2. Using the IPictureFromCBitmap function
    #include <atlbase.h>
    CComVariant IPictureFromCBitmap( CBitmap* p )
    {
    	if ( NULL != p )
    	{
    		PICTDESC pDesc = {0};
    		pDesc.cbSizeofstruct = sizeof( PICTDESC );
    		pDesc.picType = PICTYPE_BITMAP;
    		pDesc.bmp.hbitmap = (HBITMAP)p->Detach();
    		CComPtr<IPicture> spPicture;
    		if ( SUCCEEDED( OleCreatePictureIndirect( &pDesc, IID_IPicture, FALSE, (LPVOID*)&spPicture ) ) )
    			return CComVariant( CComQIPtr<IDispatch>( spPicture ) );
    	}
    	return NULL;
    }

    and you call something like node.SetPicture( IPictureFromCBitmap( &bitmap ) );

where the node member is the node in the control to put the picture, and the bitmap is an object of CBitmap type.