TextureBrush.TranslateTransform Metodo

Definizione

Trasla la trasformazione geometrica locale di questo oggetto TextureBrush in base alle dimensioni specificate nell'ordine indicato.

Overload

TranslateTransform(Single, Single)

Trasla la trasformazione geometrica locale di questo oggetto TextureBrush in base alle dimensioni specificate. Questo metodo antepone la traslazione alla trasformazione.

TranslateTransform(Single, Single, MatrixOrder)

Trasla la trasformazione geometrica locale di questo oggetto TextureBrush in base alle dimensioni specificate nell'ordine indicato.

TranslateTransform(Single, Single)

Origine:
TextureBrush.cs
Origine:
TextureBrush.cs
Origine:
TextureBrush.cs

Trasla la trasformazione geometrica locale di questo oggetto TextureBrush in base alle dimensioni specificate. Questo metodo antepone la traslazione alla trasformazione.

public:
 void TranslateTransform(float dx, float dy);
public void TranslateTransform (float dx, float dy);
member this.TranslateTransform : single * single -> unit
Public Sub TranslateTransform (dx As Single, dy As Single)

Parametri

dx
Single

Dimensione in base alla quale traslare la trasformazione nella direzione x.

dy
Single

Dimensione in base alla quale traslare la trasformazione nella direzione y.

Esempio

L'esempio seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Crea un oggetto TextureBrush.

  • Converte l'immagine della trama 50 unità nella direzione x.

  • Riempie un rettangolo sullo schermo usando il pennello di trama.

void TranslateTransform_Example1( PaintEventArgs^ e )
{
   // Create a TextureBrush object.
   TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );

   // Move the texture image 2X in the x-direction.
   tBrush->TranslateTransform( 50, 0, MatrixOrder::Prepend );

   // Fill a rectangle with tBrush.
   e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 );
}
public void TranslateTransform_Example1(PaintEventArgs e)
{
             
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
             
    // Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0, MatrixOrder.Prepend);
             
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);
}
Public Sub TranslateTransform_Example1(ByVal e As PaintEventArgs)

    ' Create a TextureBrush object.
    Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))

    ' Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0, MatrixOrder.Prepend)

    ' Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100)
End Sub

Si applica a

TranslateTransform(Single, Single, MatrixOrder)

Origine:
TextureBrush.cs
Origine:
TextureBrush.cs
Origine:
TextureBrush.cs

Trasla la trasformazione geometrica locale di questo oggetto TextureBrush in base alle dimensioni specificate nell'ordine indicato.

public:
 void TranslateTransform(float dx, float dy, System::Drawing::Drawing2D::MatrixOrder order);
public void TranslateTransform (float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order);
member this.TranslateTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub TranslateTransform (dx As Single, dy As Single, order As MatrixOrder)

Parametri

dx
Single

Dimensione in base alla quale traslare la trasformazione nella direzione x.

dy
Single

Dimensione in base alla quale traslare la trasformazione nella direzione y.

order
MatrixOrder

Ordine, di anteposizione o accodamento, in cui applicare la traslazione.

Esempio

L'esempio seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Crea un oggetto TextureBrush.

  • Converte l'immagine della trama 50 unità nella direzione x.

  • Riempie un rettangolo sullo schermo usando il pennello di trama.

void TranslateTransform_Example2( PaintEventArgs^ e )
{
   // Create a TextureBrush object.
   TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) );

   // Move the texture image 2X in the x-direction.
   tBrush->TranslateTransform( 50, 0 );

   // Fill a rectangle with tBrush.
   e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 );
}
public void TranslateTransform_Example2(PaintEventArgs e)
{
         
    // Create a TextureBrush object.
    TextureBrush tBrush = new TextureBrush(new Bitmap("texture.jpg"));
         
    // Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0);
         
    // Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100);
}
Public Sub TranslateTransform_Example2(ByVal e As PaintEventArgs)

    ' Create a TextureBrush object.
    Dim tBrush As New TextureBrush(New Bitmap("texture.jpg"))

    ' Move the texture image 2X in the x-direction.
    tBrush.TranslateTransform(50, 0)

    ' Fill a rectangle with tBrush.
    e.Graphics.FillRectangle(tBrush, 0, 0, 100, 100)
End Sub

Si applica a