ARTICLE

RotateTransform use in WPF with VB.NET

Posted by Sapna Malik Articles | WPF using VB.NET August 31, 2010
Tags: .NET, ASP.NET, VB.NET, WPF
In this article, We will see how to use RotateTransform in WPF with VB.NET.
 
Reader Level:

HTML clipboard

In this article, We will see how to use RotateTransform  in WPF with VB.NET.

RotateTransform is used for the process of rotating an element to a certain angle around a central point. We will use CenterX and CenterY properties in this control. We will use 30 degree in rotate button. The object around point values is (70,45).

Example:-

This code of .xaml:-

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Button Name="RotatingButton" Grid.Row="0" Background="Yellow" FontSize="15"
Foreground="Red" Content="Rotate Transform"
                Width="125" Height="50" HorizontalAlignment="Center"
Click="RotatingButton_Click">
            <Button.RenderTransform>
                <RotateTransform x:Name="Trans_RotatingButton" Angle="0" CenterX="70"
CenterY="45" />
            </Button.RenderTransform>
        </Button>
    </Grid>
</
Window>

This code of .vb:-

Class Window1
    Private Sub RotatingButton_Click(ByVal sender As System.Object, ByVal e As
System.Windows.RoutedEventArgs)
        If Trans_RotatingButton.Angle = 360 Then
            Trans_RotatingButton.Angle = 0
        Else
            Trans_RotatingButton.Angle += 30
        End If
    End Sub
End Class

Output:-

RotateTransform1.bmp

We will click the Rotating Button after that change the angle of Rotating Button.
OR
We will click shift button + space button of keyword in the Rotating Button after that change the angle of Rotating Button.

RotateTransform2.bmp

 

share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor