2024年5月30日发(作者:)

VFP6.0中ActiveX控件TreeView 使用实例

ActiveX control TreeView using instances in VFP6.0

ActiveX controls have long been used as an important tool for

most program developers. Since it has nothing to do with the

development language, you can use ActiveX controls on any

software platform that supports ActiveX controls. Just as

freely as using WINDOWS controls. However, many problems met

ActiveX in specific to a certain development tools to use, this

in a lot of publication of the article have often been discussed,

but most are for Vc, Delphi, VB, PB and other development

platform under the ActiveX control. In fact, the use of ActiveX

controls in the above platform can basically help in its

function, developers in accordance with their example, and

ultimately can find the ActiveX control properties, methods,

the use of events instructions. Even some development tools

have made it convenient for developers to use some ActiveX

controls as their common form controls.

But in the VFP development platform, to use the ActiveX control

as the development tool that lucky, because the VFP was not

related to the grammatical descriptions and examples, the VFP

developers feel embarrassed and confused. Because there are

very few articles on this subject. Therefore, the author is in

the development of "real estate sales software" as an example

to introduce the specific use of TreeView controls in VFP, for

the sake of the author of the same VFP colleagues reference.

First, introduce the TreeView control

The TreeView control displays a hierarchical list of Node

objects, each of which consists of a tag and an optional bitmap

Node. TreeView is typically used to display document titles,

index entries, files and directories on disk, or other kinds

of information that can be effectively layered.

The Node object is an item in the TreeView control that contains

images and text. The Nodes collection contains one or more Node

objects. Syntax: , (index).

You can use standard collection methods (such as Add and Remove

methods) to operate Node objects. You can access each element

in the collection by its index or the unique key stored in the

Key property. To select the specified Node object, you must

refer to it through its Index attribute or the value of the Key

property.

Add a Node object in the Nodes collection of the Treeview

control: (relative, relationship, key, text, image,

selectedimage). The Nodes collection is a collection based on

1. When a Node object is added, it is assigned an index number

that is stored in the Index attribute of the Node object. The

Index attribute value of this latest member is the value of the

Count property of the Node collection. Because the Add method

returns a reference to the newly created Node object, it is very

convenient to use this reference to set the properties of the

new Node. Here are a few properties of the node:

Relative is optional. That represents the index number or key

value of the existing Node object. The relationship between the

new node and the existing node can be found in the next parameter,

relationship.