Wait Cursor with Timer?
-
For a treeview i would like to change the mouse cursor to an hour glass after a delay when selected tree nodes take a long time to populate. I was able to do this in VB6 using a timer event, where a busy flag is set and then the timer event checks flag to determine if cursor should be changed to an hour glass. When i try to do similar in C# the cursor does not change. I am able to change the cursor in the code populating the node, but that causes flickering becasue the hourglass is shown even when selected nodes do not take long to populate. Am i dealing with some kind of multi thread issue here? What is the normal solution?
-
For a treeview i would like to change the mouse cursor to an hour glass after a delay when selected tree nodes take a long time to populate. I was able to do this in VB6 using a timer event, where a busy flag is set and then the timer event checks flag to determine if cursor should be changed to an hour glass. When i try to do similar in C# the cursor does not change. I am able to change the cursor in the code populating the node, but that causes flickering becasue the hourglass is shown even when selected nodes do not take long to populate. Am i dealing with some kind of multi thread issue here? What is the normal solution?
when your about to do your complex and time costing code, simply add this.Cursor = Cursor.Busy; // your code this.Cursor = Cursor.Default;