Taal

Graphics.TranslateClip Methode

Definitie

Vertaalt het knipgebied van dit Graphics door opgegeven bedragen in de horizontale en verticale richting.

Overloads

Name Description
TranslateClip(Int32, Int32)

Vertaalt het knipgebied van dit Graphics door opgegeven bedragen in de horizontale en verticale richting.

TranslateClip(Single, Single)

Vertaalt het knipgebied van dit Graphics door opgegeven bedragen in de horizontale en verticale richting.

TranslateClip(Int32, Int32)

Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs

Vertaalt het knipgebied van dit Graphics door opgegeven bedragen in de horizontale en verticale richting.

public:
 void TranslateClip(int dx, int dy);
public void TranslateClip(int dx, int dy);
member this.TranslateClip : int * int -> unit
Public Sub TranslateClip (dx As Integer, dy As Integer)

Parameters

dx
Int32

De x-coördinaat van de vertaling.

dy
Int32

De y-coördinaat van de vertaling.

Voorbeelden

Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een parameter van de Paint gebeurtenis-handler. De code voert de volgende acties uit:

  • Hiermee maakt u een rechthoek voor het knipgebied.

  • Hiermee stelt u het knipgebied in op de rechthoek.

  • Vertaalt het knipgebied op een vector (50, 50).

  • Vult een grote rechthoek met een effen zwarte borstel.

Het resultaat is een vertaalde, kleine, zwarte rechthoek.

public:
   void TranslateClipInt( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      Rectangle clipRect = Rectangle(0,0,100,100);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Translate clipping region.
      int dx = 50;
      int dy = 50;
      e->Graphics->TranslateClip( dx, dy );

      // Fill rectangle to demonstrate translated clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void TranslateClipInt(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Translate clipping region.
    int dx = 50;
    int dy = 50;
    e.Graphics.TranslateClip(dx, dy);

    // Fill rectangle to demonstrate translated clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub TranslateClipInt(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New Rectangle(0, 0, 100, 100)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Translate clipping region.
    Dim dx As Integer = 50
    Dim dy As Integer = 50
    e.Graphics.TranslateClip(dx, dy)

    ' Fill rectangle to demonstrate translated clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Van toepassing op

TranslateClip(Single, Single)

Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs
Bron:
Graphics.cs

Vertaalt het knipgebied van dit Graphics door opgegeven bedragen in de horizontale en verticale richting.

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

Parameters

dx
Single

De x-coördinaat van de vertaling.

dy
Single

De y-coördinaat van de vertaling.

Voorbeelden

Het volgende codevoorbeeld is ontworpen voor gebruik met Windows Forms en vereist PaintEventArgse, een parameter van de Paint gebeurtenis-handler. De code voert de volgende acties uit:

  • Hiermee maakt u een rechthoek voor het knipgebied.

  • Hiermee stelt u het knipgebied in op de rechthoek.

  • Vertaalt het knipgebied op een vector (50,0F, 50,0F).

  • Vult een grote rechthoek met een effen zwarte borstel.

Het resultaat is een vertaalde, kleine, zwarte rechthoek.

public:
   void TranslateClipFloat( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Translate clipping region.
      float dx = 50.0F;
      float dy = 50.0F;
      e->Graphics->TranslateClip( dx, dy );

      // Fill rectangle to demonstrate translated clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void TranslateClipFloat(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Translate clipping region.
    float dx = 50.0F;
    float dy = 50.0F;
    e.Graphics.TranslateClip(dx, dy);

    // Fill rectangle to demonstrate translated clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub TranslateClipFloat(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Translate clipping region.
    Dim dx As Single = 50.0F
    Dim dy As Single = 50.0F
    e.Graphics.TranslateClip(dx, dy)

    ' Fill rectangle to demonstrate translated clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Van toepassing op