protected void CreateBrushes(TreeNodeAdv node, DrawContext context, string text, out Brush backgroundBrush, out Color textColor, out Font font, ref string label) { textColor=SystemColors.ControlText; backgroundBrush=null; font=context.Font; if(context.DrawSelection==DrawSelectionMode.Active) { textColor=SystemColors.HighlightText; backgroundBrush=SystemBrushes.Highlight; } else if(context.DrawSelection==DrawSelectionMode.Inactive) { textColor=SystemColors.ControlText; backgroundBrush=SystemBrushes.InactiveBorder; } else if(context.DrawSelection==DrawSelectionMode.FullRowSelect) textColor=SystemColors.HighlightText; if(!context.Enabled) textColor=SystemColors.GrayText; if(DrawTextMustBeFired(node)) { DrawEventArgs args=new DrawEventArgs(node, this, context, text); args.Text=label; args.TextColor=textColor; args.BackgroundBrush=backgroundBrush; args.Font=font; OnDrawText(args); textColor=args.TextColor; backgroundBrush=args.BackgroundBrush; font=args.Font; label=args.Text; } }
protected virtual void OnDrawText(DrawEventArgs args) { TreeViewAdv tree=args.Node.Tree; if(tree!=null) tree.FireDrawControl(args); if(DrawText!=null) DrawText(this, args); }
protected Font GetDrawingFont(TreeNodeAdv node, DrawContext context, string label) { Font font=context.Font; if(DrawTextMustBeFired(node)) { DrawEventArgs args=new DrawEventArgs(node, this, context, label); args.Font=context.Font; OnDrawText(args); font=args.Font; } return font; }