With The Case Of  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
ActiveX COM Products
Technical Support
  General Q & A
Discussion Board
Contact Us


Get Ready to Unleash the Power of UCanCode .NET

UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"

VC++ Example: Tree Control With Expand node, SetImageList, InsertItem, NM_CLICK, TVN_ITEMEXPANDING


Tree Control Messages


Most messages of the tree controls are notification messages that are sent to its parent window. For example, the NM_CLICK message is sent to the dialog box or the form, that acts as the parent, that the tree control has been clicked. If the click was done with the right mouse button, the NM_RCLICK message is sent instead. In the same way, if the user double-clicks the control an NM_DBLCLK message is sent. If the user double-clicked with the right mouse button, the NM_CDBLCLK message is sent.

As mentioned already, the user has the ability to expand a node that has at least one child. When the user initiates an action that would expand a node, the tree control sends a TVN_ITEMEXPANDING. After the item has expanded, the control sends the TVN_ITEMEXPANDED message.

Tree Control With Bitmaps or Icons


Bitmaps can be used to enhanced the display of items on a tree control. Each tree item can be configured to display or not to display a small picture on its left. To do this, you can declare a CImageList variable and add pictures to it. Once the image list is ready, you can call the CTreeCtrl::SetImageList() method. Its syntax is:

CImageList* SetImageList(CImageList * pImageList, int nImageListType);

The first argument, pImageList, is a pointer to a CImageList variable. The nImageListType argument specifies the type of image list that will be used. The possible values are:

Value Type Description
LVSIL_NORMAL  The image list is made of large icons
LVSIL_SMALL  The image list is made of small icons
LVSIL_STATE  The image list is made of state images

To specify the pictures used for a tree item, call one of the following versions of the CTreeCtrl:: InsertItem() methods:

                                    LPCTSTR lpszItem,
                                    int nImage,
                                     int nSelectedImage,
                                     UINT nState,
                                     LPARAM lParam,
                                     HTREEITEM hParent,
                                     HTREEITEM hInsertAfter );
HTREEITEM InsertItem(LPCTSTR lpszItem,
                                    int nImage,
                                    int nSelectedImage, 
                                    HTREEITEM hParent = TVI_ROOT,
                                    HTREEITEM hInsertAfter = TVI_LAST);

The argument specifies the type of value used to set on the list item. As seen already, the lpszItem is the text that will be displayed for the current item.

The value of nImage is the index of the image used for the item being inserted from the image list. The nSelectedImage value is the index of the image that will display when the inserted item is selected or has focus.



Copyright ?1998-2009 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to