TreeView's operation

xiaoxiao2021-03-06  16

///

/// 归 中 中 点 //// /// Node /// BOOL value < / param> private void CheckAllChildNodes (TreeNode treeNode, bool nodeChecked) {foreach (TreeNode node in treeNode.Nodes) {node.Checked = nodeChecked; if (node.Nodes.Count> 0) {// if the current node has a child node Call the recursive function this.checkAllChildNodes (node, nodechecked);}}} /// /// Toned a permission of a operator /// /// permissions tree /// module ID private void CallRecursive (TreeView treeView, string [] PopeArray) {TreeNodeCollection nodes = treeView.Nodes; foreach (TreeNode n in Nodes) {//n.checked = true; PrintRecursive (N, PopeArray);}} /// /// recursion call /// /// node /// Module ID Private void PrintRecursive (Treenode Treenode, String [] PopeArray) {Foreach (TREENODE TNION TREENODE.NODES) {FOREACH (String Str In PopeArray) {if (str.trim (). Tostring () == ((com.js.park.dmt.dmtmodule) TN.TAG) .MOD_ID.TRIM (). Tostring ()) {Tn.Checked = TRUE ; TN.Parent.checked = true;}} PrintRecursive (TN, PopeArray);}} /// /// Set tree node background color /// /// /// private void settreebackrecurs (Treenode Treenode, Bool _flag) {forEach (Treenode Tn in Treenode.Nodes) {if (_flag ==

True) tn.backcolor = system.drawing.color.White; Else Tn.backcolor = system.drawing.color.fromargb ((System.byte) ((System.byte)), (240)), (250))); settreebackrecursive (TN, _FLAG);}} #Region tree node Drag Private void TRV_PARKTREE_DRAGDROP (Object sender, system.windows.forms.drageventargs e) {// Take source node information String Treenode SourceNode = this.trv_parktree.selectedNode; string Dummy = "TEMP"; string source_text = "String Source_text =" String Source_Text = "String Target_text =" "; int source_id = 0; source_Text = source_Text.Substring (source_Text.IndexOf (": ") 1) .Trim (); string soruceNodeType = this.checkNode (sourceNode); TreeNode DragNode = new TreeNode (source_Text); // Create a node DragNode.Tag = sourceNode.Tag; switch (soruceNodeType) // take the source node type associated ID {case "ParkNode": source_id = ((OMTPark) this.trv_ParkTree.SelectedNode.Tag) .PRK_ID; DragNode.ImageIndex = 0; Break; Case "root ParkNode ": source_id = ((OMTPark) this.trv_ParkTree.SelectedNode.Tag) .PRK_ID; soruceNodeType =" ParkNode "; DragNode.ImageIndex = 1; break; case" ComputerNode ": source_id = ((OMTComputer) this.trv_ParkTree.SelectedNode .Tag) .COM_ID; DragNode.ImageIndex = 2; break; case "MachineNode": source_id = ((OMTMachine) this.trv_ParkTree.SelectedNode.Tag) .MAC_NO; DragNode.ImageIndex = 3; break; default: break;} / /MessageBox.show (Source_Text "" SoruCenodeType); // Take the target node information m_position.x = ex; m_position.y = EY;

m_Position = trv_ParkTree.PointToClient (m_Position); TreeNode DropNode = this.trv_ParkTree.GetNodeAt (m_Position); string targetNodeType = this.checkNode (DropNode); target_Text = DropNode.Text.Trim (); //MessageBox.Show (DropNode.Text ); // Add item IF (DropNode! = Null && source_id.toDE! = Null && source_id.toDETRING ()! = ") {If (SorucenodeType ==" ComputerNode "&&tNodeType ==" ") || (soruceNodeType ==" ParkNode "&& targetNodeType ==" ParkNode ") || (soruceNodeType ==" ComputerNode "&& targetNodeType ==" ParkNode ") || (soruceNodeType ==" MachineNode "&& targetNodeType ==" ComputerNode ")) {if (source_Text == target_Text) {MessageBox.Show (this," drop location is not right "," prompt ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;} if (targetNodeType ==" RootParkNode " && SoruCenodetype == "ParkNode") {(OMTPARK) SourceNode.tag) .ppark_id = ((OMTPARK) DropNode.tag) .prk_id; ((OMTPARK) SourceNode.tag) .store ();} else == "ParkNode" && soruceNodeType == "ComputerNode" || targetNodeType == "RootParkNode" && soruceNodeType == "ComputerNode") {((OMTComputer) sourceNode.Tag) .PRK_ID = ((OMTPark) DropNode.Tag) .PRK_ID ((OMTComputer) Source.tag) .Store ();} else if (targetnodetype == "computernode" && SorucenodeType == "Machinenode"

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

New Post(0)