Monthly Archives: August 2009

Treeivew with custom colors

Several times we have been asked in the forums if there was any way to customize the individual items off a Treeview control.

treeviewcolor.png

The only difference of this component with the native Xailer Treeview is that it doesn’t have visual editor for aItems property and must be filled at design time with the context menu or at runtime with one of the following methods:

METHOD AddItem( cItem, xImage, xSelImage, lBold, lChecked, lParam, nClrText, nClrPane ) // --> oItem
METHOD InsertItem( cItem, xImage, xSelImage, lBold, lChecked, lParam, nClrText, nClrPane, nPos ) // --> oItem

As you can see, these methods add two new parameters to set the text and background color of each item and are fully compatible with standard Treeview, allowing the use of images, checkboxes, etc..

The attached ZIP treeviewcolor.zip includes the DLL for the IDE and the library to link to applications.