Graphics.TranslateClip 메서드

정의

가로와 세로 방향으로 지정된 크기만큼 이 Graphics의 클립 영역을 변환합니다.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

오버로드

TranslateClip(Int32, Int32)

가로와 세로 방향으로 지정된 크기만큼 이 Graphics의 클립 영역을 변환합니다.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

TranslateClip(Single, Single)

가로와 세로 방향으로 지정된 크기만큼 이 Graphics의 클립 영역을 변환합니다.Translates the clipping region of this Graphics by specified amounts in the horizontal and vertical directions.

TranslateClip(Int32, Int32)

가로와 세로 방향으로 지정된 크기만큼 이 Graphics의 클립 영역을 변환합니다.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)

매개 변수

dx
Int32

변환의 X좌표입니다.The x-coordinate of the translation.

dy
Int32

변환의 Y좌표입니다.The y-coordinate of the translation.

예제

다음 코드 예제는 Windows Forms와 함께 사용 하도록 설계 되었으며 PaintEventArgs e 이벤트 처리기의 매개 변수인가 필요 합니다 Paint .The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 코드는 다음 작업을 수행합니다.The code performs the following actions:

  • 클리핑 영역에 대 한 사각형을 만듭니다.Creates a rectangle for the clipping region.

  • 클리핑 영역을 사각형으로 설정 합니다.Sets the clipping region to the rectangle.

  • 클리핑 영역을 벡터 (50, 50)로 변환 합니다.Translates the clipping region by a vector (50, 50).

  • 단색 브러시를 사용 하 여 긴 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 변환 된 작은 검정색 사각형입니다.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)

가로와 세로 방향으로 지정된 크기만큼 이 Graphics의 클립 영역을 변환합니다.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)

매개 변수

dx
Single

변환의 X좌표입니다.The x-coordinate of the translation.

dy
Single

변환의 Y좌표입니다.The y-coordinate of the translation.

예제

다음 코드 예제는 Windows Forms와 함께 사용 하도록 설계 되었으며 PaintEventArgs e 이벤트 처리기의 매개 변수인가 필요 합니다 Paint .The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 코드는 다음 작업을 수행합니다.The code performs the following actions:

  • 클리핑 영역에 대 한 사각형을 만듭니다.Creates a rectangle for the clipping region.

  • 클리핑 영역을 사각형으로 설정 합니다.Sets the clipping region to the rectangle.

  • 클리핑 영역을 벡터 (50.0 F, 50.0 F)로 변환 합니다.Translates the clipping region by a vector (50.0F, 50.0F).

  • 단색 브러시를 사용 하 여 긴 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 변환 된 작은 검정색 사각형입니다.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

적용 대상