當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET Matrix.Multiply方法代碼示例

本文整理匯總了VB.NET中System.Drawing.Drawing2D.Matrix.Multiply方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Matrix.Multiply方法的具體用法?VB.NET Matrix.Multiply怎麽用?VB.NET Matrix.Multiply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Drawing2D.Matrix的用法示例。


在下文中一共展示了Matrix.Multiply方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: MultiplyExample

Public Sub MultiplyExample(ByVal e As PaintEventArgs)
    Dim myPen As New Pen(Color.Blue, 1)
    Dim myPen2 As New Pen(Color.Red, 1)

    ' Set up the matrices.
    Dim myMatrix1 As New Matrix(2.0F, 0.0F, 0.0F, 1.0F, 0.0F, 0.0F)

    ' Scale.
    Dim myMatrix2 As New Matrix(0.0F, 1.0F, -1.0F, 0.0F, 0.0F, 0.0F)

    ' Rotate 90.
    Dim myMatrix3 As New Matrix(1.0F, 0.0F, 0.0F, 1.0F, 250.0F, 50.0F)

    ' Display the elements of the starting matrix.
    ListMatrixElementsHelper(e, myMatrix1, "Beginning Matrix", 6, 40)

    ' Multiply Matrix1 by Matrix 2.
    myMatrix1.Multiply(myMatrix2, MatrixOrder.Append)

    ' Display the result of the multiplication of Matrix1 and
    ' Matrix2.
    ListMatrixElementsHelper(e, myMatrix1, _
    "Matrix After 1st Multiplication", 6, 60)

    ' Multiply the result from the pervious multiplication by
    ' Matrix3.
    myMatrix1.Multiply(myMatrix3, MatrixOrder.Append)

    ' Display the result of the previous multiplication
    ' multiplied by Matrix3.
    ListMatrixElementsHelper1(e, myMatrix1, _
    "Matrix After 2nd Multiplication", 6, 80)

    ' Draw the rectangle prior to transformation.
    e.Graphics.DrawRectangle(myPen, 0, 0, 100, 100)
    e.Graphics.Transform = myMatrix1

    ' Draw the rectangle after transformation.
    e.Graphics.DrawRectangle(myPen2, 0, 0, 100, 100)
End Sub

' A helper function to list the contents of a matrix.
Public Sub ListMatrixElementsHelper1(ByVal e As PaintEventArgs, _
ByVal matrix As Matrix, ByVal matrixName As String, ByVal numElements As Integer, _
ByVal y As Integer)

    ' Set up variables for drawing the array

    ' of points to the screen.
    Dim i As Integer
    Dim x As Single = 20
    Dim j As Single = 200
    Dim myFont As New Font("Arial", 8)
    Dim myBrush As New SolidBrush(Color.Black)

    ' Draw the matrix name to the screen.
    e.Graphics.DrawString(matrixName + ":  ", myFont, myBrush, x, y)

    ' Draw the set of path points and types to the screen.
    For i = 0 To numElements - 1
        e.Graphics.DrawString(matrix.Elements(i).ToString() + ", ", _
        myFont, myBrush, j, y)
        j += 30
    Next i
End Sub
開發者ID:VB.NET開發者,項目名稱:System.Drawing.Drawing2D,代碼行數:65,代碼來源:Matrix.Multiply

示例2: Test

' 導入命名空間
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

public class Test
   public Shared Sub Main
        Dim X As New Matrix(2.0F, 1.0F, 3.0F, 1.0F, 0.0F, 4.0F)
        Dim Y As New Matrix(0.0F, 1.0F, -1.0F, 0.0F, 0.0F, 0.0F)

        X.Multiply(Y, MatrixOrder.Append)
        ' Read the result Matrix
        Dim i As Integer
        For i = 0 To X.Elements.Length - 1
            Console.WriteLine(X.Elements(i).ToString())
        Next i


   End Sub
End class
開發者ID:VB程序員,項目名稱:System.Drawing.Drawing2D,代碼行數:20,代碼來源:Matrix.Multiply


注:本文中的System.Drawing.Drawing2D.Matrix.Multiply方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。