How to Use a Matrix to Rotate in VB.NET
Visual Basic.NET (VB.NET) is computer programming language by Microsoft. VB.NET is a declarative, object-oriented and structured language that was influenced by Microsoft's .NET framework. VB.NET is commonly used in conjunction with C#.NET or ASP.NET to create web applications. It is also commonly used to create desktop software applications for the Windows operating system. The VB.NET "Matrix.Rotate Method" is implemented into a project to rotate an object according to the angle that you specify.
Instructions
-
-
1
Launch the Microsoft Visual Studio.NET integrated development environment application. Open the Visual Basic.NET project in which you want to implement code for the "Matrix.Rotate Method."
-
2
Copy and paste the following code example and implement it into your Visual Studio.NET project:
Public Sub RotateMatrix (ByVal e As PaintEventArgs)
Dim pencil1 As New Pen(Color.Blue, 1)
Dim pencil2 As New Pen(Color.Red, 1)
e.Graphics.DrawRectangle(pencil1, 250, 150, 300, 200)
Dim myMatrix As New Matrix
myMatrix.Rotate(45, MatrixOrder.Append)
e.Graphics.Transform = myMatrix
e.Graphics.DrawRectangle(pencil2, 250, 150, 300, 200)
End Sub
Edit the "Graphics.DrawRectangle Method" parameters and the angle rotation according to your needs.
-
-
3
Press "Ctrl" and "S" to save the Visual Basic.NET project.
-
1