2014-07-21 101 views
0

我在Visual Studio 2013中創建了Windows應用商店應用程序,而且我真的不知道如何在c#中的PointerEntered上旋轉按鈕。使用懸停,我只想旋轉360度角。如果有人能幫助我,我將不勝感激。在Visual Studio 2013中旋轉按鈕c#

+1

埃姆..如果你將它旋轉360度,你根本就沒有旋轉它。你的意思是動畫嗎? – tnw

+0

你是在動畫旋轉之後? – Tanner

+0

好吧,罰135度,我不知道,x度∈[1,359]。 – user2216845

回答

0

這裏是MSDN一個例子:

的XAML:

<Canvas Height="200" Width="200"> 

    <!-- Rotates the Polyline 45 degrees about the point (0,0). --> 
    <Polyline Points="25,25 0,50 25,75 50,50 25,25 25,0" 
    Stroke="Blue" StrokeThickness="10" 
    Canvas.Left="75" Canvas.Top="50"> 
    <Polyline.RenderTransform> 
     <RotateTransform CenterX="0" CenterY="0" Angle="45" /> 
    </Polyline.RenderTransform> 
    </Polyline> 
</Canvas> 

C#代碼: (使用此作爲,如有必要,...)

// Create a Polyline. 
Polyline polyline1 = new Polyline(); 
polyline1.Points.Add(new Point(25, 25)); 
polyline1.Points.Add(new Point(0, 50)); 
polyline1.Points.Add(new Point(25, 75)); 
polyline1.Points.Add(new Point(50, 50)); 
polyline1.Points.Add(new Point(25, 25)); 
polyline1.Points.Add(new Point(25, 0)); 
polyline1.Stroke = Brushes.Blue; 
polyline1.StrokeThickness = 10; 

// Create a RotateTransform to rotate 
// the Polyline 45 degrees about its 
// top-left corner. 
RotateTransform rotateTransform1 = 
    new RotateTransform(45); 
polyline1.RenderTransform = rotateTransform1; 

// Create a Canvas to contain the Polyline. 
Canvas canvas1 = new Canvas(); 
canvas1.Width = 200; 
canvas1.Height = 200; 
Canvas.SetLeft(polyline1, 75); 
Canvas.SetTop(polyline1, 50); 
canvas1.Children.Add(polyline1);