Similar to classification attribute table controls in VB

zhaozj2021-02-08  273

Similar to classification attribute table controls in VB

Author: Xu Jing Zhou

Download instance code (http://www.9cbs.net/cnshare/soft/12/12322.shtm)

If you have seen the classification attribute table in VB, you will not be strange! This property table is not only beautiful, but also very simple, easy to operate. Below I have done a control similar to this type of VB, the example is as follows:

Basic composition: This control is derived from ListBox, and the list is filled with three columns. Where the first list is required as a bitmap displayed, the second list is the attribute name that cannot be edited, and the third list is an editable button, pull-down box, edit box, etc. The first column makes the replacement display bitmap and expands or contracted related entries; the second column shows the fixed attribute name when the creation; the third column can determine what controls in it can be created according to the creation type specified in the creation. (Button, dropboard, edit box, etc.). Specific implementation methods can refer to the source code in the download sample.

Let me talk about how to use them in your project file:

1. Copy the two bitmaps in the sample project: expand.bmp and unnexpand.bmp into your project resource res directory, import them to name: idb_property_expand and idb_property_unexpand.

2. Copy the control files in the sample project: PropertyList.cpp and PropertyList.h to your project and import them.

3, create a new ListBox control in the relevant dialog in your project file, and create a member variable m_clist, change the derived class of its member variable to CPropertyList in the header file.

4. Add #include "PropertyList.h" in the above-described dialog box, which defines the variable in this class as follows:

CPROPERTYLIST * m_plist; // vb attribute table control

CPropertyItem * m_pclassname; // Public property Category Name

CPropertyItem * m_pname; // Name

5. In the initialization dialog box of the dialog box class, the content is created, as follows:

// Initialize the VB property table control

M_plist = & m_clist;

// Common Properties, Jignzhou Xu

m_pclassname = new CPROPERTYITEM ("Public Properties", ", Pit_EDit," ", True, True, 0);

m_pname = new CPROPERTYITEM ("Name", "", Pit_EDit, "", False, False, 0);

6. In the onDestroy in the above dialog class, delete the created property entry, as follows:

Delete m_pclassname;

DELETE M_PNAME;

7, remain left, you can get or set the corresponding value from its created variable, as follows:

/ / Assignment to the attribute table

m_pname-> m_curvalue = pgraph-> getnodename ();

or

/ / Get the value from the corresponding entry from the property table

PGRAPH-> nodename = m_pname-> m_curvalue

Among them, the specific implementation method can be referred to as it can be seen after downloading the sample source code.

Contact information:

Author email: jingzhou_xu@163.com

Future Studio (Future Studio)

转载请注明原文地址:https://www.9cbs.com/read-2129.html

New Post(0)