次の方法で共有


Graphics.TranslateClip メソッド (Single, Single)

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

Overloads Public Sub TranslateClip( _
   ByVal dx As Single, _   ByVal dy As Single _)
[C#]
public void TranslateClip(floatdx,floatdy);
[C++]
public: void TranslateClip(floatdx,floatdy);
[JScript]
public function TranslateClip(
   dx : float,dy : float);

パラメータ

  • dx
    平行移動の x 成分。
  • dy
    平行移動の y 成分。

戻り値

このメソッドは値を返しません。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • クリッピング領域に使用する四角形を作成します。
  • クリッピング領域を四角形に設定します。
  • ベクタ (50.0F, 50.0F) でクリッピング領域を平行移動します。
  • 黒いソリッド ブラシで大きな四角形を塗りつぶします。

[Visual Basic, C#] 平行移動した小さな黒い四角形が生成されます。

 
Public Sub TranslateClipFloat(e As PaintEventArgs)
' Create rectangle for clipping region.
Dim clipRect As New RectangleF(0F, 0F, 100F, 100F)
' Set clipping region of graphics to rectangle.
e.Graphics.SetClip(clipRect)
' Translate clipping region.
Dim dx As Single = 50F
Dim dy As Single = 50F
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
        
[C#] 
public 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);
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.TranslateClip オーバーロードの一覧