private 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 (DrawText != null)
{
DrawEventArgs args = new DrawEventArgs(node, context, text);
args.TextColor = textColor;
args.BackgroundBrush = backgroundBrush;
args.Font = font;
OnDrawText(args);
textColor = args.TextColor;
backgroundBrush = args.BackgroundBrush;
font = args.Font;
label = args.Text;
}
}