Matrix Transforms: Scale : Matrix « Windows Presentation Foundation « VB.Net






Matrix Transforms: Scale

Matrix Transforms: Scale
 

<Window x:Class="WpfApplication1.MatrixTransforms"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Matrix Transforms" Height="450" Width="270">
  <StackPanel>
    <TextBlock Margin="10,10,5,5" Text="Original Matrix:" />
    <TextBlock Name="tbOriginal" Margin="20,0,5,5" />
    <TextBlock Margin="10,0,5,5" Text="Scale:" />
    <TextBlock Name="tbScale" Margin="20,0,5,5" />


  </StackPanel>
</Window>

//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Media


Namespace WpfApplication1
  Public Partial Class MatrixTransforms
    Inherits Window
    Public Sub New()
      InitializeComponent()
      ' Original matrix: 
      Dim m As New Matrix(1, 2, 3, 4, 0, 1)
      tbOriginal.Text = "(" & m.ToString() & ")"


      'Scale: 
      m.Scale(1, 0.5)



      tbScale.Text = "(" & m.ToString() & ")"
    End Sub


    Private Function MatrixRound(m As Matrix) As Matrix
      m.M11 = Math.Round(m.M11, 3)
      m.M12 = Math.Round(m.M12, 3)
      m.M21 = Math.Round(m.M21, 3)
      m.M22 = Math.Round(m.M22, 3)
      m.OffsetX = Math.Round(m.OffsetX, 3)
      m.OffsetY = Math.Round(m.OffsetY, 3)
      Return m
    End Function
  End Class
End Namespace

   
  








Related examples in the same category

1.Matrix Operations
2.Matrix Transforms: Scale - Prepend
3.Matrix Transforms: Rotation atMatrix Transforms: Rotation at
4.Matrix Transforms: Skew -Prepend
5.Matrix Transforms: Skew
6.Matrix Transforms: Rotation at (x = 1, y = 2) - Prepend
7.Matrix Transforms: Rotation - Prepend
8.Matrix Transforms: Rotation
9.Matrix Transforms: Translation