internal NodeFilteringStatus GetNodeFilteringStatus(TreeNode node) { NodeFilteringStatus stat = NodeFilteringStatus.Normal; if (node != null && node.Tag != null && IsFiltering) { if (!IsFullyExpaned(node.Tag)) { stat |= NodeFilteringStatus.PartiallyExpanded; } bool anymatched = IsMatched(node.Tag); if (anymatched) { stat |= NodeFilteringStatus.Visible; // any child mat if (m_treeView.GetChildren(node.Tag).Any(IsMatched)) { stat |= NodeFilteringStatus.ChildVisible; } } } return(stat); }
/// <summary> /// Draws the expander icon at the given location, in the state given by /// the node's Expanded property and the size specified by ExpanderSize</summary> /// <param name="node">The node to draw an expander icon for</param> /// <param name="g">The current GDI+ graphics object</param> /// <param name="x">The x-coordinate of the upper-left corner of the expander icon</param> /// <param name="y">The y-coordinate of the upper-left corner of the expander icon</param> public virtual void DrawExpander(TreeControl.Node node, Graphics g, int x, int y) { NodeFilteringStatus stat = FilteringStatus != null ? FilteringStatus(node) : NodeFilteringStatus.Normal; bool partial = (stat & NodeFilteringStatus.PartiallyExpanded) == NodeFilteringStatus.PartiallyExpanded; bool hasChildMatch = (stat & NodeFilteringStatus.ChildVisible) == NodeFilteringStatus.ChildVisible; Brush bkg = null; Pen frg = null; if (node.Expanded) { if (partial) { bkg = NoMatchHighlightBrush; } else { m_tmp.Color = m_expanderPen.Color; bkg = m_tmp; } } else { if (hasChildMatch) { bkg = m_matchedHighlightBrush; } else { frg = m_expanderPen; } } node.PartiallyExpanded = false; // reset GdiUtil.DrawExpander(g, x, y, ExpanderSize.Height, node.Expanded, bkg, frg); //node.PartiallyExpanded = false; // reset //GdiUtil.DrawExpander(x, y, ExpanderSize.Height, m_expanderPen, node.Expanded, g); }