Graphics.TranslateClip メソッド

定義

指定した量だけ水平方向および垂直方向に、この Graphics のクリッピング領域を平行移動します。

オーバーロード

TranslateClip(Int32, Int32)

指定した量だけ水平方向および垂直方向に、この Graphics のクリッピング領域を平行移動します。

TranslateClip(Single, Single)

指定した量だけ水平方向および垂直方向に、この Graphics のクリッピング領域を平行移動します。

TranslateClip(Int32, Int32)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

指定した量だけ水平方向および垂直方向に、この Graphics のクリッピング領域を平行移動します。

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 座標。

dy
Int32

平行移動する y 座標。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • クリッピング領域の四角形を作成します。

  • クリッピング領域を四角形に設定します。

  • クリッピング領域をベクター (50、50) で変換します。

  • 大きな四角形に黒いソリッド ブラシを塗りつぶします。

結果は、翻訳された小さな黒い四角形になります。

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.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

指定した量だけ水平方向および垂直方向に、この Graphics のクリッピング領域を平行移動します。

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 座標。

dy
Single

平行移動する y 座標。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • クリッピング領域の四角形を作成します。

  • クリッピング領域を四角形に設定します。

  • クリッピング領域をベクター (50.0F、50.0F) で変換します。

  • 大きな四角形に黒いソリッド ブラシを塗りつぶします。

結果は、翻訳された小さな黒い四角形になります。

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

適用対象