First of all, im not really sure how to explain this very well as I am finding it very very strange.
I am trying to draw a grid into a form and have the colours of the grid change if they are selected by the user.
Here is my draw and mouse event handler:
GridNode.Draw is defined like this:
private void OnPaint(object sender, PaintEventArgs e)
//m_mainGrid.IsSelected = true;
foreach (GridNode node in m_mainGrid)
private void OnClick(object sender, EventArgs e)
m_mainGrid.IsSelected = true;
The problem I am having is that even when the node is selected it gets drawn as red. The debugger breaks into the DrawMethod and sets it to Green and it never breaks into the line where it goes to red. But still the image on my screen is red.
public void Draw(bool showId, bool showPos)
Painter.Instance.FillBorderRectangle(Rect, Color.Green, Color.Black);
Painter.Instance.FillBorderRectangle(Rect, Color.Red, Color.Black);
If I uncomment the m_mainGrid.IsSelected = true line, it does show up as green.