/// <summary> /// Select the TreeNode in the MWTreeNodeWrapper object supplied. /// </summary> /// <param name="mwtnw">MWTreeNodeWrapper containing TreeNode that should be selected.</param> public static void Select(MWTreeNodeWrapper mwtnw) { mwtnw.Node.ImageIndex = mwtnw.SelectedImageIndex; mwtnw.BackColor = mwtnw.Node.BackColor; mwtnw.ForeColor = mwtnw.Node.ForeColor; }
/// <summary> /// Deselect the TreeNode in the MWTreeNodeWrapper object supplied. /// </summary> /// <param name="mwtnw">MWTreeNodeWrapper containing TreeNode that should be deselected.</param> public static void Deselect(MWTreeNodeWrapper mwtnw) { mwtnw.Node.ImageIndex = mwtnw.ImageIndex; mwtnw.Node.SelectedImageIndex = mwtnw.SelectedImageIndex; if (mwtnw.Node.TreeView != null && mwtnw.Node.TreeView.Enabled) { mwtnw.Node.BackColor = mwtnw.BackColor; mwtnw.Node.ForeColor = mwtnw.ForeColor; } }
/// <summary> /// Remove an array of TreeNodes contained in MWTreeNodeWrappers. The TreeNodes are also removed from the SelNodes property, the /// CheckedNodes property and/or the SelNode property. /// </summary> /// <param name="amwtnw">MWTreeNodeWrapper array whose TreeNodes should be removed.</param> /// <returns>True if at least one TreeNode from the MWTreeNodeWrappers was removed or false if no TreeNodes were removed.</returns> public bool RemoveNodes(MWTreeNodeWrapper[] amwtnw) { bool bRetVal = false; if(amwtnw != null) { foreach(MWTreeNodeWrapper mwtnw in amwtnw) { if(RemoveNode(mwtnw)) { bRetVal = true; } } } return bRetVal; }
/// <summary> /// Remove one TreeNode contained in an MWTreeNodeWrapper. The TreeNode is also removed from the SelNodes property, the CheckedNodes /// property and/or the SelNode property. /// </summary> /// <param name="mwtnw">MWTreeNodeWrapper to remove.</param> /// <returns>True if the TreeNode in the MWTreeNodeWrapper was removed or false otherwise.</returns> public bool RemoveNode(MWTreeNodeWrapper mwtnw) { bool bRetVal = false; if(mwtnw != null) { bRetVal = RemoveNode(mwtnw.Node); } return bRetVal; }
/// <summary> /// Get the ForeColor of the MWTreeNodeWrapper supplied. /// Note that this method works even if the MWTreeNodeWrapper is selected and/or if the MWTreeView is disabled (Enabled property set to false). /// </summary> /// <param name="mwtnw">MWTreeNodeWrapper to get the ForeColor of.</param> /// <returns>ForeColor of the MWTreeNodeWrapper supplied.</returns> public static Color GetForeColor(MWTreeNodeWrapper mwtnw) { return GetForeColor(mwtnw.Node); }
/// <summary> /// Change the SelectedImageIndex of the supplied MWTreeNodeWrapper's TreeNode. /// </summary> /// <param name="tn">MWTreeNodeWrapper whose TreeNode to change the SelectedImageIndex of.</param> /// <param name="iSelectedImageIndex">SelectedImageIndex to change to.</param> public static void ChangeTreeNodeSelectedImageIndex(MWTreeNodeWrapper mwtnw, int iSelectedImageIndex) { if(mwtnw != null) { if((mwtnw.Node.TreeView as MWTreeView).IsTreeNodeSelected(mwtnw.Node)) { mwtnw.SelectedImageIndex = iSelectedImageIndex; mwtnw.Node.ImageIndex = iSelectedImageIndex; mwtnw.Node.SelectedImageIndex = iSelectedImageIndex; } else { mwtnw.Node.SelectedImageIndex = iSelectedImageIndex; } } }
/// <summary> /// Enable MWTreeNodeWrapper supplied. /// </summary> /// <param name="mwtnw">MWTreeNodeWrapper to enable.</param> private void EnableNode(MWTreeNodeWrapper mwtnw) { if(IsTreeNodeSelected(mwtnw.Node)) { if(this.HideSelection && !this.Focused || !this.Enabled) { (GetSelectedMWTreeNodeWrapper(mwtnw.Node)).Enable(); } else { if(this.UseExtendedDisabledColors) { mwtnw.Enable(); } else { mwtnw.Node.BackColor = SystemColors.Control; mwtnw.Node.ForeColor = SystemColors.WindowText; } } } else { mwtnw.Enable(); } }
/// <summary> /// Deactivate TreeNode of MWTreeNodeWrapper supplied. /// Deactivating means removing higlighting ('lowlighting'). /// </summary> /// <param name="mwtnw">MWTreeNodeWrapper whose TreeNode should be deactivated.</param> private void DeactivateSelNode(MWTreeNodeWrapper mwtnw) { if(mwtnw != null && mwtnw.Node != null) { if(this.HideSelection) { if(IsPlainColoredTreeNode(mwtnw.Node)) { LowlightNode(mwtnw.Node); } else { mwtnw.Node.BackColor = mwtnw.BackColor; mwtnw.Node.ForeColor = mwtnw.ForeColor; } } else { HighlightNode(mwtnw.Node, false); } } }