3 Imports System
.Windows
.Controls
4 Imports System
.Windows
.Media
5 Imports System
.Windows
.Navigation
6 Imports System
.Threading
10 Public Class LayoutTransformVB
15 WindowTitle
= "LayoutTransform Sample"
16 ' Create a Grid as the Root Panel
17 Dim grid1
As New Grid()
18 grid1
.HorizontalAlignment
= Windows
.HorizontalAlignment
.Left
19 grid1
.VerticalAlignment
= Windows
.VerticalAlignment
.Top
20 grid1
.ShowGridLines
= True
22 Dim colDef1
As New ColumnDefinition()
23 colDef1
.Width
= GridLength
.Auto
24 Dim colDef2
As New ColumnDefinition()
25 colDef2
.Width
= GridLength
.Auto
26 grid1
.ColumnDefinitions
.Add(colDef1
)
27 grid1
.ColumnDefinitions
.Add(colDef2
)
29 Dim rowDef1
As New RowDefinition()
30 rowDef1
.Height
= GridLength
.Auto
31 Dim rowDef2
As New RowDefinition()
32 rowDef2
.Height
= GridLength
.Auto
33 Dim rowDef3
As New RowDefinition()
34 rowDef3
.Height
= GridLength
.Auto
35 Dim rowDef4
As New RowDefinition()
36 rowDef4
.Height
= GridLength
.Auto
37 Dim rowDef5
As New RowDefinition()
38 rowDef5
.Height
= GridLength
.Auto
39 Dim rowDef6
As New RowDefinition()
40 rowDef6
.Height
= GridLength
.Auto
41 grid1
.RowDefinitions
.Add(rowDef1
)
42 grid1
.RowDefinitions
.Add(rowDef2
)
43 grid1
.RowDefinitions
.Add(rowDef3
)
44 grid1
.RowDefinitions
.Add(rowDef4
)
45 grid1
.RowDefinitions
.Add(rowDef5
)
46 grid1
.RowDefinitions
.Add(rowDef6
)
48 ' RotateTransform Sample
49 Dim btn1
As New Button()
50 btn1
.Background
= Brushes
.LightCoral
51 btn1
.Content
= "No Transform Applied"
53 Grid
.SetColumn(btn1
, 0)
54 grid1
.Children
.Add(btn1
)
57 Dim btn2
As New Button()
58 btn2
.Background
= Brushes
.LightCoral
59 btn2
.Content
= "RotateTransform"
60 btn2
.LayoutTransform
= New RotateTransform(45, 25, 25)
62 Grid
.SetColumn(btn2
, 1)
63 grid1
.Children
.Add(btn2
)
66 ' SkewTransform Sample
67 Dim btn3
As New Button()
68 btn3
.Background
= Brushes
.LightCyan
69 btn3
.Content
= "No Transform Applied"
71 Grid
.SetColumn(btn3
, 0)
72 grid1
.Children
.Add(btn3
)
74 Dim btn4
As New Button()
75 btn4
.Background
= Brushes
.LightCyan
76 btn4
.Content
= "SkewTransform"
77 btn4
.LayoutTransform
= New SkewTransform(45, 0, 0, 0)
79 Grid
.SetColumn(btn4
, 1)
80 grid1
.Children
.Add(btn4
)
82 ' ScaleTransform Sample
83 Dim btn5
As New Button()
84 btn5
.Background
= Brushes
.LightSlateGray
85 btn5
.Content
= "No Transform Applied"
87 Grid
.SetColumn(btn5
, 0)
88 grid1
.Children
.Add(btn5
)
90 Dim btn6
As New Button()
91 btn6
.Background
= Brushes
.LightSlateGray
92 btn6
.Content
= "ScaleTransform"
93 btn6
.LayoutTransform
= New ScaleTransform(2, 2, 25, 25)
95 Grid
.SetColumn(btn6
, 1)
96 grid1
.Children
.Add(btn6
)
98 ' TranslateTransform Sample
99 Dim btn7
As New Button()
100 btn7
.Background
= Brushes
.LightSeaGreen
101 btn7
.Content
= "No Transform Applied"
103 Grid
.SetColumn(btn7
, 0)
104 grid1
.Children
.Add(btn7
)
106 Dim btn8
As New Button()
107 btn8
.Background
= Brushes
.LightSeaGreen
108 btn8
.Content
= "TranslateTransform: RenderTransform"
109 btn8
.RenderTransform
= New TranslateTransform(100, 200)
111 Grid
.SetColumn(btn8
, 1)
112 grid1
.Children
.Add(btn8
)
114 ' TranslateTransform Sample
115 Dim btn9
As New Button()
116 btn9
.Background
= Brushes
.LightBlue
117 btn9
.Content
= "No Transform Applied"
119 Grid
.SetColumn(btn9
, 0)
120 grid1
.Children
.Add(btn9
)
122 Dim btn10
As New Button()
123 btn10
.Background
= Brushes
.LightBlue
124 btn10
.Content
= "TranslateTransform: LayoutTransform"
125 btn10
.LayoutTransform
= New TranslateTransform(100, 200)
126 Grid
.SetRow(btn10
, 4)
127 Grid
.SetColumn(btn10
, 1)
128 grid1
.Children
.Add(btn10
)
130 ' MatrixTransform Sample
131 Dim btn11
As New Button()
132 btn11
.Background
= Brushes
.LightGoldenrodYellow
133 btn11
.Content
= "No Transform Applied"
134 Grid
.SetRow(btn11
, 5)
135 Grid
.SetColumn(btn11
, 0)
136 grid1
.Children
.Add(btn11
)
138 Dim btn12
As New Button()
139 btn12
.Background
= Brushes
.LightGoldenrodYellow
140 btn12
.Content
= "MatrixTransform"
141 btn12
.LayoutTransform
= New MatrixTransform(1, 3, 3, 3, 3, 3)
142 Grid
.SetRow(btn12
, 5)
143 Grid
.SetColumn(btn12
, 1)
144 grid1
.Children
.Add(btn12
)
153 Protected Overrides
Sub OnStartup(ByVal e
As StartupEventArgs
)
155 CreateAndShowMainWindow()
158 Private Sub CreateAndShowMainWindow()
159 ' Create the application's main window.
160 Dim myWindow
As New NavigationWindow()
162 Dim myContent
As New LayoutTransformVB()
163 myWindow
.Navigate(myContent
)
164 MainWindow
= myWindow
168 ' Starts the application.
169 Public NotInheritable Class EntryClass
171 Public Shared
Sub Main()