Specifically what I am looking to do is make the icons for the Nodes in my System.Windows.Forms.TreeView control to throb while a long loading operation is taking place.
+1
A:
If you load each frame into an ImageList, you can use a loop to update to each frame. Example:
bool runThrobber = true; private void AnimateThrobber(TreeNode animatedNode) { BackgroundWorker bg = new BackgroundWorker(); bg.DoWork += new DoWorkEventHandler(delegate { while (runThrobber) { this.Invoke((MethodInvoker)delegate { animatedNode.SelectedImageIndex++; if (animatedNode.SelectedImageIndex >= imageList1.Images.Count) > animatedNode.SelectedImageIndex = 0; }); Thread.Sleep(100); } }); bg.RunWorkerAsync(); }
Obviously there's more than a few ways to implement this, but here's the basic idea.
Factor Mystic
2008-09-13 00:08:10
Looking at this again, you should really check and see if the image index is in the bounds of the imagelist.images count before you increment it.
Factor Mystic
2008-09-13 03:19:53