TextureBrush.TranslateTransform Método

Definição

Move a transformação geométrica local desse objeto TextureBrush nas dimensões especificadas e na ordem especificada.

Sobrecargas

TranslateTransform(Single, Single)

Move a transformação geométrica local desse objeto TextureBrush nas dimensões especificadas. Esse método precede a translação para a transformação.

TranslateTransform(Single, Single, MatrixOrder)

Move a transformação geométrica local desse objeto TextureBrush nas dimensões especificadas e na ordem especificada.

TranslateTransform(Single, Single)

Move a transformação geométrica local desse objeto TextureBrush nas dimensões especificadas. Esse método precede a translação para a 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 pelo qual se move a transformação na direção x.

dy
Single

A dimensão pelo qual se move a transformação na direção y.

Exemplos

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

  • Cria um objeto TextureBrush.

  • Converte a imagem de textura 50 unidades na direção x.

  • Preenche um retângulo na tela, 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)

Move a transformação geométrica local desse objeto TextureBrush nas dimensões especificadas e 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 pelo qual se move a transformação na direção x.

dy
Single

A dimensão pelo qual se move a transformação na direção y.

order
MatrixOrder

A ordem (preceder ou acrescentar) em que a translação é aplicada.

Exemplos

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

  • Cria um objeto TextureBrush.

  • Converte a imagem de textura 50 unidades na direção x.

  • Preenche um retângulo na tela, 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