public int Draw(Graphics g)
{
DrawNode();
// Create font for text
Font nodeFont = new Font(FontFamily.GenericSansSerif, 10f, FontStyle.Regular);
// Fill node if selected
if (m\_selected)
{
g.FillPath(Brushes.Red, m\_gpTextBacking);
g.DrawString(m\_name, nodeFont, Brushes.White, m\_fontLocation);
}
else
{
g.DrawString(m\_name, nodeFont, Brushes.Black, m\_fontLocation);
}
// Draw node backing if hover is true
if (m\_hover)
{
g.DrawPath(Pens.Black, m\_gpTextBacking);
}
// Draw expand box
g.FillPath(Brushes.Gray, m\_gpExpandBox);
g.DrawPath(Pens.Black, m\_gpExpandBox);
// Dispose of graphics paths
------> //m_gpExpandBox.Dispose();
------> //m_gpTextBacking.Dispose();
Thank you for the help found the soulution. It now works when comment out the indicated lines