Udostępnij za pośrednictwem


TextureBrush.TranslateTransform Metoda

Definicja

Tłumaczy lokalną transformację geometryczną tego obiektu TextureBrush według określonych wymiarów w określonej kolejności.

Przeciążenia

TranslateTransform(Single, Single)

Tłumaczy lokalną transformację geometryczną tego obiektu TextureBrush według określonych wymiarów. Ta metoda poprzedza tłumaczenie przekształcenia.

TranslateTransform(Single, Single, MatrixOrder)

Tłumaczy lokalną transformację geometryczną tego obiektu TextureBrush według określonych wymiarów w określonej kolejności.

TranslateTransform(Single, Single)

Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs

Tłumaczy lokalną transformację geometryczną tego obiektu TextureBrush według określonych wymiarów. Ta metoda poprzedza tłumaczenie przekształcenia.

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)

Parametry

dx
Single

Wymiar, za pomocą którego można przetłumaczyć transformację w kierunku x.

dy
Single

Wymiar, za pomocą którego można przetłumaczyć transformację w kierunku y.

Przykłady

Poniższy przykład jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse, który jest parametrem programu obsługi zdarzeń Paint. Kod wykonuje następujące akcje:

  • Tworzy obiekt TextureBrush.

  • Tłumaczy obraz tekstury 50 jednostek w kierunku x.

  • Wypełnia prostokąt na ekranie za pomocą pędzla tekstury.

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

Dotyczy

TranslateTransform(Single, Single, MatrixOrder)

Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs
Źródło:
TextureBrush.cs

Tłumaczy lokalną transformację geometryczną tego obiektu TextureBrush według określonych wymiarów w określonej kolejności.

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)

Parametry

dx
Single

Wymiar, za pomocą którego można przetłumaczyć transformację w kierunku x.

dy
Single

Wymiar, za pomocą którego można przetłumaczyć transformację w kierunku y.

order
MatrixOrder

Kolejność (wstępnego lub dołączania), w której ma być stosowane tłumaczenie.

Przykłady

Poniższy przykład jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse, który jest parametrem programu obsługi zdarzeń Paint. Kod wykonuje następujące akcje:

  • Tworzy obiekt TextureBrush.

  • Tłumaczy obraz tekstury 50 jednostek w kierunku x.

  • Wypełnia prostokąt na ekranie za pomocą pędzla tekstury.

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

Dotyczy