I think the problem might be you are doing some drawing even if the else was executed ->
e.DrawDefault = true;
. This means that when you're handler is done, the value of
DrawDefault
is used to determine if any drawing must be done.
This code is outside of that logic and could be repainted by the default handler:
if (intFlag != 1)
{
e.Graphics.DrawString(clsCommon.Right(e.Node.Tag.ToString(), 8), tagFont, Brushes.Black, 435, e.Bounds.Top);
}
if ((e.State & TreeNodeStates.Focused) != 0)
{
using (Pen focusPen = new Pen(Color.Black))
{
focusPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
Rectangle focusBounds = NodeBounds(e.Node);
focusBounds.Size = new Size(focusBounds.Width - 1,
focusBounds.Height - 1);
e.Graphics.DrawRectangle(focusPen, focusBounds);
}
}
}
Good luck!