How do i rotate a 2D picturebox according to my mouse
        Posted  
        
            by 
                Gwenda.T
            
        on Programmers
        
        See other posts from Programmers
        
            or by Gwenda.T
        
        
        
        Published on 2013-06-27T03:14:21Z
        Indexed on 
            2013/06/27
            4:30 UTC
        
        
        Read the original article
        Hit count: 380
        
I would want to rotate my picturebox which contains an image. The image will just spin around following the mouse, but the position of the image is fixed. Any idea on how it should be done? Btw using Visual Studio 2012 C# Windows phone application for Windows Phone 8. I've did a little research on google but the other codes were from VS2012 using a WinForm But it's different now I'm not able to use their code. So I was hoping I could find some answer at here!
Currently now I have this
        private void arrowHead_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {
        Duration Time_duration = new Duration(TimeSpan.FromSeconds(0.5));
        Storyboard MyStory = new Storyboard();
        MyStory.Duration = Time_duration;
        DoubleAnimation My_Double = new DoubleAnimation();
        My_Double.Duration = Time_duration;
        MyStory.Children.Add(My_Double);
        RotateTransform MyTransform = new RotateTransform();
        Storyboard.SetTarget(My_Double, MyTransform);
        Storyboard.SetTargetProperty(My_Double, new PropertyPath("Angle"));
        My_Double.To = 15;
        arrowHead.RenderTransform = MyTransform;
        arrowHead.RenderTransformOrigin = new Point(0.5, 0.5);
        //stackPanel1.Children.Add(image1);
        MyStory.Begin();
    }
This is my only way of tilting the image however now I want it to follow my mouse! Thanks!
© Programmers or respective owner