Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need some help about controlling the continuous rotation of a fan image by the start and stop button in visual studio 2012 wpf visual basic...need xaml code and a bit explanation for understanding the process..i,ll be very thankful
Posted
Comments
Sergey Alexandrovich Kryukov 3-Nov-14 13:46pm    
This is fairly simple thing, so it's unclear what the problem is.
What have you tried so far? Even without stopping/starting...
—SA

1 solution

Like most problems it needs to be broken down into components.
The form will have the buttons with event handlers which will call start and stop methods for the fan image.
The real issue to consider is, if the fan is made to rotate continuously in the host form the whole application will freeze and user will not be able to do anything else.
This means the fan image needs to be in another thread or controlled with a background worker. So, some choices are:

1. add Background Worker to main form or custom user control and use that to start and stop the continuous loop. this loop must have a way to be interrupted, e.g if CancellationPending, or

2. use threads. Background Worker does all this for you and it's safer because accessing a form from a thread can cause an exception.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900