I have a treeview, trvActors.
When I try to change the forecolor of a treenode by clicking on it, it does not seem to work, but the surrounding code works.
((Actor)_rightClickedNode.Tag).IsDefault = true;
_rightClickedNode.ForeColor = Color.Red;
Weirdly enough, the isDefault value changes, but the node does not change color. This is occurring on a toolstripmenuitem click, but the same thing is also occurring on a simple right click.
Here is the code for a right click on the private void trvActors_MouseClick event:
trvActors.SelectedNode = trvActors.GetNodeAt(e.X, e.Y);
if (trvActors.SelectedNode != null)
{
if (e.Button == MouseButtons.Right)
{
_rightClickedNode = trvActors.SelectedNode;
((Actor)_rightClickedNode.Tag).IsDefault = true;
_rightClickedNode.ForeColor = Color.Red;
}
}
Same outcome. The only time I seem to be able to change the forecolor is when I am initially creating the nodes. Any ideas?