TextureBrush.TranslateTransform Método

Definição

Traduz a transformação geométrica local deste TextureBrush objeto pelas dimensões especificadas na ordem especificada.

Sobrecargas

Name Description
TranslateTransform(Single, Single)

Traduz a transformação geométrica local deste TextureBrush objeto pelas dimensões especificadas. Este método antepõe a translação à transformação.

TranslateTransform(Single, Single, MatrixOrder)

Traduz a transformação geométrica local deste TextureBrush objeto pelas dimensões especificadas na ordem especificada.

TranslateTransform(Single, Single)

Traduz a transformação geométrica local deste TextureBrush objeto pelas dimensões especificadas. Este método antepõe a translação à transformação.

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)

Parâmetros

dx
Single

A dimensão pela qual se deve translar a transformação na direção x.

dy
Single

A dimensão pela qual se deve translar a transformação na direção y.

Exemplos

O exemplo seguinte foi concebido para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do handler de eventos Paint. O código executa as seguintes ações:

  • Cria um objeto TextureBrush.

  • Traduz a imagem da textura em 50 unidades na direção x.

  • Preenche um retângulo no ecrã, usando o pincel de textura.

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

Aplica-se a

TranslateTransform(Single, Single, MatrixOrder)

Traduz a transformação geométrica local deste TextureBrush objeto pelas dimensões especificadas na ordem especificada.

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)

Parâmetros

dx
Single

A dimensão pela qual se deve translar a transformação na direção x.

dy
Single

A dimensão pela qual se deve translar a transformação na direção y.

order
MatrixOrder

A ordem (prepender ou anexar) em que aplicar a tradução.

Exemplos

O exemplo seguinte foi concebido para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do handler de eventos Paint. O código executa as seguintes ações:

  • Cria um objeto TextureBrush.

  • Traduz a imagem da textura em 50 unidades na direção x.

  • Preenche um retângulo no ecrã, usando o pincel de textura.

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

Aplica-se a