[Original] [ActiveX] TreeView Full Example

xiaoxiao2021-03-06  102

When many are pursuing a variety of directory Tree, I moved out TreeView that I think is the best function and performance, but it is not beautiful! function Init () {with (TreeView1) {LineStyle = 1; DragMode = 0; BorderStyle = 0; ToolTipText = "[ActiveX Control] TreeView complete presentation"; var node = null; node = Nodes .Add (NULL, 0, "R", "root"); // node. Nodes.add ("r", 4, "p1", "item1"); nodes.add ("r", 4, " P2 "," item2 "); nodes.add (" r ", 4," p3 "," item0 "); nodes.add (" p1 ", 4," c1 "," child 2 "); nodes.add ("P1", 4, "C2", "Child 1"); Nodes.Add ("C1", 4, "C3", "Child 3"); Nodes.Add ("C2", 4, "C4" , "10"); Nodes.Add ("C2", 4, "C5", "01"); Nodes.Add ("C2", 4, "C6", "03"); Nodes.Add ("C2 "4," c7 "," 02 ");}} init ();

Function Sort (FLAG) {for (var i = 1; i <= TreeView1.nodes.count; i ) {TreeView1.nodes (i). Sorted = flag;}}

Function deletenode () {var Iindex; IINDEX = TreeView1.selectedItem.index; TreeView1.nodes.Remove (IIndex);

Function deletetree () {TreeView1.nodes.clear ();

Function checknode (node) {var IIndex = 0; with (TreeView1) {if (node.children> 0) {iIndex = node.child.index; while (IIndex! = (node.child.lastsibling.index) {nodes (IIndex) .checked = node.checked; if (nodes (iDex) .children> 0) {CheckNode (nodes (ionex));} IIndex = nodes (iIndex) .Next.index;} IIdex = node.child.lastsibling .Index; nodes (inedex) .checked = node.checked; if (iindex) .children> 0) {CheckNode (nodes (});}}}} Function AddNode (Level, Key, Text) {//// Level: // 0: First // 1: Last bar // 2: Next // 3: Previous // 4: Child Node Var vkey; vkey = TreeView1.SelectedItem.Key; TreeView1.nodes.Add ( Vkey, Level, Key, Text);

Function addrootnode (key, text) {TreeView1.nodes.add (Null, 0, Key, Text);