Matrix.Translate Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Applica il vettore di traslazione specificato alla classe Matrix anteponendolo.
Overload
Translate(Single, Single) |
Applica il vettore di traslazione specificato ( |
Translate(Single, Single, MatrixOrder) |
Applica il vettore di traslazione specificato alla classe Matrix nell'ordine indicato. |
Translate(Single, Single)
- Origine:
- Matrix.cs
- Origine:
- Matrix.cs
- Origine:
- Matrix.cs
Applica il vettore di traslazione specificato (offsetX
e offsetY
) alla classe Matrix anteponendolo.
public:
void Translate(float offsetX, float offsetY);
public void Translate (float offsetX, float offsetY);
member this.Translate : single * single -> unit
Public Sub Translate (offsetX As Single, offsetY As Single)
Parametri
Esempio
Per un esempio, vedere Translate(Single, Single, MatrixOrder).
Si applica a
Translate(Single, Single, MatrixOrder)
- Origine:
- Matrix.cs
- Origine:
- Matrix.cs
- Origine:
- Matrix.cs
Applica il vettore di traslazione specificato alla classe Matrix nell'ordine indicato.
public:
void Translate(float offsetX, float offsetY, System::Drawing::Drawing2D::MatrixOrder order);
public void Translate (float offsetX, float offsetY, System.Drawing.Drawing2D.MatrixOrder order);
member this.Translate : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub Translate (offsetX As Single, offsetY As Single, order As MatrixOrder)
Parametri
- order
- MatrixOrder
Enumerazione MatrixOrder che specifica l'ordine (antecedente o posticipato) in cui viene applicata la traslazione alla classe Matrix.
Esempio
L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse
, un Paint oggetto evento. Il codice esegue le azioni seguenti:
Disegna un rettangolo sullo schermo prima di applicare una trasformazione di conversione (rettangolo blu).
Crea una matrice e la traduce per 100 in entrambi gli assi.
Applica questa trasformazione matrice al rettangolo,
Disegna il rettangolo trasformato sullo schermo (rettangolo rosso).
Si noti che l'inizio del rettangolo rosso si trova 100 punti in entrambi gli assi dall'inizio del triangolo blu.
public:
void TranslateExample( PaintEventArgs^ e )
{
Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );
// Draw a rectangle to the screen before applying the
// transform.
e->Graphics->DrawRectangle( myPen, 20, 20, 100, 50 );
// Create a matrix and translate it.
Matrix^ myMatrix = gcnew Matrix;
myMatrix->Translate( 100, 100, MatrixOrder::Append );
// Draw the Points to the screen again after applying the
// transform.
e->Graphics->Transform = myMatrix;
e->Graphics->DrawRectangle( myPen2, 20, 20, 100, 50 );
}
public void TranslateExample(PaintEventArgs e)
{
Pen myPen = new Pen(Color.Blue, 1);
Pen myPen2 = new Pen(Color.Red, 1);
// Draw a rectangle to the screen before applying the
// transform.
e.Graphics.DrawRectangle(myPen, 20, 20, 100, 50);
// Create a matrix and translate it.
Matrix myMatrix = new Matrix();
myMatrix.Translate(100, 100, MatrixOrder.Append);
// Draw the Points to the screen again after applying the
// transform.
e.Graphics.Transform = myMatrix;
e.Graphics.DrawRectangle(myPen2, 20, 20, 100, 50);
}
Public Sub TranslateExample(ByVal e As PaintEventArgs)
Dim myPen As New Pen(Color.Blue, 1)
Dim myPen2 As New Pen(Color.Red, 1)
' Draw a rectangle to the screen before applying the
' transform.
e.Graphics.DrawRectangle(myPen, 20, 20, 100, 50)
' Create a matrix and translate it.
Dim myMatrix As New Matrix
myMatrix.Translate(100, 100, MatrixOrder.Append)
' Draw the Points to the screen again after applying the
' transform.
e.Graphics.Transform = myMatrix
e.Graphics.DrawRectangle(myPen2, 20, 20, 100, 50)
End Sub
Si applica a
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per