/// <summary> /// Gets the background color for a treenode. /// </summary> /// <param name="highlight">True if the background color is part of a highlight area (e.g. selection, drop-target)</param> public Color GetNodeBackColor(TreeNode tn, Boolean highlight) { if (tn == null || this.Colors == null) return Color.Empty; if (highlight && tn.HasStateFlag(TreeNodeStates.DropTarget)) return this.Colors.DropTargetBackground.Color; if (highlight && tn.HasStateFlag(TreeNodeStates.Selected)) return this.Colors.SelectionBackground.Color; if (highlight && tn.HasStateFlag(TreeNodeStates.ParentOfSelected)) return this.Colors.ParentBackground.Color; if (highlight && !tn.BackColor.IsEmpty) return tn.BackColor; else if (this.Colors.AlternateBackground && this.isAlternatingTn(tn)) return this.Colors.AltBackground.Color; else return this.Colors.Background.Color; }
/// <summary> /// Gets the foreground color for a treenode. /// </summary> /// <param name="highlight">True if the foreground color is part of a highlight area (e.g. selection, drop-target)</param> public Color GetNodeForeColor(TreeNode tn, Boolean highlight) { if (tn == null || this.Colors == null) return Color.Empty; if (tn.HasStateFlag(TreeNodeStates.DropTarget)) return this.Colors.DropTargetForeground.Color; else if (tn.HasStateFlag(TreeNodeStates.Selected)) return this.Colors.SelectionForeground.Color; else if (tn.HasStateFlag(TreeNodeStates.ParentOfSelected)) return this.Colors.ParentForeground.Color; Color color; if (tn.ForeColor != Color.Empty) color = tn.ForeColor; else { color = Outliner.MaxUtils.Colors.SelectContrastingColor( this.GetNodeBackColor(tn, highlight) , this.Colors.ForegroundLight.Color , this.Colors.ForegroundDark.Color); } return Color.FromArgb(this.GetNodeOpacity(tn), color); }