SkewTransform use in WPF with VB.NET

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

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

The SkewTransform is used to skew an element. The properties use CenterX, CenterY, AngleX and AngleY in SkewTransform. The CenterX and CenterY property represent X and Y coordinates of the center point. And the AngleX and AngleY property represent x-axis and y-axis use for skew angle.

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="SkewButton" Grid.Row="2" Width="150" Height="75" FontSize="15"
Foreground="Red" Background="Pink" HorizontalAlignment="Center" Content="Skew Transform"
Click="SkewButton_Click">
            <Button.RenderTransform>
                <SkewTransform x:Name="Trans_SkewButton" CenterX="75" CenterY="35"
AngleX="0" AngleY="0" />
            </Button.RenderTransform>
        </Button>
    </Grid>
</
Window>

This code of .vb:-

Class Window1
    Private Sub SkewButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        Dim skew As Double = 30
        If Trans_SkewButton.AngleX = 45 Then
            skew = 0
        End If
        Trans_SkewButton.AngleX = skew
        Trans_SkewButton.AngleY = skew
    End Sub
End Class

Output:-

SkewTransform1.bmp
 

After click the skew button, button show as a 3D and I am using angle 45 degree in this coding.

SkewTransform2.bmp
 

I hope this article help you.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.