Pradeep
Pradeep

Reputation:

.Net [Windows] TreeView TreeNode does not retain color change after drag and drop

I have a form with 2 tree views, the user can drag and drop a node from one to another. After a node has been dragged and dropped, I change the color[highlight] of the source node in the Drag-Drop event handles.The color of the node changes fine.

But when the users hovers the mouse over the source tree view after that, it flickers and the highlighting I had done disappears, reverting to the original color.

I'm not handling any other event, I don't reload the treeview and I'm not changing the color.

From my understanding of the MSDN documentation, I don't see any Refresh or Repaint type events.

Upvotes: 0

Views: 2133

Answers (1)

Artem Tikhomirov
Artem Tikhomirov

Reputation: 21726

Simply call TreeView.Invalidate() method to force tree view to repaint.

Upvotes: 1

Related Questions