Graphics.TranslateClip Graphics.TranslateClip Graphics.TranslateClip Graphics.TranslateClip Method

Definizione

Trasla l'area di visualizzazione di questo oggetto Graphics secondo i valori specificati nelle direzioni orizzontale e verticale.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

Overload

TranslateClip(Int32, Int32) TranslateClip(Int32, Int32) TranslateClip(Int32, Int32) TranslateClip(Int32, Int32)

Trasla l'area di visualizzazione di questo oggetto Graphics secondo i valori specificati nelle direzioni orizzontale e verticale.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

TranslateClip(Single, Single) TranslateClip(Single, Single) TranslateClip(Single, Single) TranslateClip(Single, Single)

Trasla l'area di visualizzazione di questo oggetto Graphics secondo i valori specificati nelle direzioni orizzontale e verticale.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

TranslateClip(Int32, Int32) TranslateClip(Int32, Int32) TranslateClip(Int32, Int32) TranslateClip(Int32, Int32)

Trasla l'area di visualizzazione di questo oggetto Graphics secondo i valori specificati nelle direzioni orizzontale e verticale.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

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)

Parametri

dx
Int32 Int32 Int32 Int32

Coordinata x della traslazione.The x-coordinate of the translation.

dy
Int32 Int32 Int32 Int32

Coordinata y della traslazione.The y-coordinate of the translation.

Esempi

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgs e, che Paint è un parametro del gestore eventi.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. Nel codice vengono eseguite le seguenti azioni:The code performs the following actions:

  • Crea un rettangolo per l'area di ridimensionamento.Creates a rectangle for the clipping region.

  • Imposta l'area di ridimensionamento sul rettangolo.Sets the clipping region to the rectangle.

  • Converte l'area di ridimensionamento in base a un vettore (50, 50).Translates the clipping region by a vector (50, 50).

  • Riempie un rettangolo di grandi dimensioni con un pennello nero a tinta unita.Fills a large rectangle with a solid black brush.

Il risultato è un rettangolo tradotto, piccolo e nero.The result is a translated, small, black rectangle.

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

TranslateClip(Single, Single) TranslateClip(Single, Single) TranslateClip(Single, Single) TranslateClip(Single, Single)

Trasla l'area di visualizzazione di questo oggetto Graphics secondo i valori specificati nelle direzioni orizzontale e verticale.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

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)

Parametri

dx
Single Single Single Single

Coordinata x della traslazione.The x-coordinate of the translation.

dy
Single Single Single Single

Coordinata y della traslazione.The y-coordinate of the translation.

Esempi

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgs e, che Paint è un parametro del gestore eventi.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. Nel codice vengono eseguite le seguenti azioni:The code performs the following actions:

  • Crea un rettangolo per l'area di ridimensionamento.Creates a rectangle for the clipping region.

  • Imposta l'area di ridimensionamento sul rettangolo.Sets the clipping region to the rectangle.

  • Converte l'area di ridimensionamento in base a un vettore (50.0 F, 50.0 F).Translates the clipping region by a vector (50.0F, 50.0F).

  • Riempie un rettangolo di grandi dimensioni con un pennello nero a tinta unita.Fills a large rectangle with a solid black brush.

Il risultato è un rettangolo tradotto, piccolo e nero.The result is a translated, small, black rectangle.

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

Si applica a