I am trying to code a method that accepts the direction of rotation and the angle with which to make the rotation of the Image object in the Picture Box but am having difficulty completing it. The method takes an Image object, the angle of rotation and the direction whether clockwise or anti-clockwise as parameters and returns a manipulated Image object to the calling function. How do I achieve this in C#?
private Image RotateImage(Image image, double angle, string direction){
//TO DO
//check the direction and proceed
switch(direction){
case "clockwise":
//do the computation for clockwise rotation and update the image
break;
case "anti-clockwise":
//do the computation for anti-clockwise rotation and update the image
break;
}
//return the image to the calling function
return image;
}
I am using a timer to create the illusion of a fan rotating continuously and modifying the interval of the timer to control the speed of the fan as its just playing with the refresh rate of the image on the picture box control.