Share via


Graphics.IntersectClip メソッド

定義

この Graphics のクリップ領域を現在のクリップ領域と指定した Rectangle 構造体との交差部分に更新します。

オーバーロード

IntersectClip(Rectangle)

この Graphics のクリップ領域を現在のクリップ領域と指定した Rectangle 構造体との交差部分に更新します。

IntersectClip(RectangleF)

この Graphics のクリップ領域を現在のクリップ領域と指定した RectangleF 構造体との交差部分に更新します。

IntersectClip(Region)

この Graphics のクリップ領域を現在のクリップ領域と指定した Region との交差部分に更新します。

IntersectClip(Rectangle)

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

この Graphics のクリップ領域を現在のクリップ領域と指定した Rectangle 構造体との交差部分に更新します。

public:
 void IntersectClip(System::Drawing::Rectangle rect);
public void IntersectClip (System.Drawing.Rectangle rect);
member this.IntersectClip : System.Drawing.Rectangle -> unit
Public Sub IntersectClip (rect As Rectangle)

パラメーター

rect
Rectangle

現在のクリップ領域と交差する Rectangle 構造体。

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

  • 左上隅が (0, 0) の四角形を作成し、クリッピング領域をこの四角形に設定します。

  • 左上隅が (100,100) の 2 番目の四角形を作成し、クリッピング領域をこの四角形と現在のクリッピング領域 (最初の四角形) の交差部分に設定します。

  • 前の両方の四角形を含む大きな四角形に、青い実線のブラシを塗りつぶします。

  • クリッピング領域を無限にリセットします。

  • 2 つのクリッピング領域の周りに四角形を描画します。 最初のクリッピング四角形には黒いペンを使用し、2 番目のクリッピング領域には赤いペンを使用します。

結果として、2 つの四角形の交差部分のみが青で塗りつぶされます。

public:
   void IntersectClipRectangle( PaintEventArgs^ e )
   {
      // Set clipping region.
      Rectangle clipRect = Rectangle(0,0,200,200);
      e->Graphics->SetClip( clipRect );

      // Update clipping region to intersection of
      // existing region with specified rectangle.
      Rectangle intersectRect = Rectangle(100,100,200,200);
      e->Graphics->IntersectClip( intersectRect );

      // Fill rectangle to demonstrate effective clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 );

      // Reset clipping region to infinite.
      e->Graphics->ResetClip();

      // Draw clipRect and intersectRect to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect );
      e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect );
   }
private void IntersectClipRectangle(PaintEventArgs e)
{

    // Set clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 200, 200);
    e.Graphics.SetClip(clipRect);

    // Update clipping region to intersection of

    // existing region with specified rectangle.
    Rectangle intersectRect = new Rectangle(100, 100, 200, 200);
    e.Graphics.IntersectClip(intersectRect);

    // Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);

    // Reset clipping region to infinite.
    e.Graphics.ResetClip();

    // Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
    e.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);
}
Private Sub IntersectClipRectangle(ByVal e As PaintEventArgs)

    ' Set clipping region.
    Dim clipRect As New Rectangle(0, 0, 200, 200)
    e.Graphics.SetClip(clipRect)

    ' Update clipping region to intersection of

    ' existing region with specified rectangle.
    Dim intersectRect As New Rectangle(100, 100, 200, 200)
    e.Graphics.IntersectClip(intersectRect)

    ' Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    500, 500)

    ' Reset clipping region to infinite.
    e.Graphics.ResetClip()

    ' Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Black), clipRect)
    e.Graphics.DrawRectangle(New Pen(Color.Red), intersectRect)
End Sub

注釈

このメソッドは、現在のクリップ領域と パラメーターで指定された四角形の積集合で表される領域を、このGraphicsプロパティにrect割り当てますClip

適用対象

IntersectClip(RectangleF)

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

この Graphics のクリップ領域を現在のクリップ領域と指定した RectangleF 構造体との交差部分に更新します。

public:
 void IntersectClip(System::Drawing::RectangleF rect);
public void IntersectClip (System.Drawing.RectangleF rect);
member this.IntersectClip : System.Drawing.RectangleF -> unit
Public Sub IntersectClip (rect As RectangleF)

パラメーター

rect
RectangleF

現在のクリップ領域と交差する RectangleF 構造体。

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

  • 左上隅が (0, 0) の四角形を作成し、クリッピング領域をこの四角形に設定します。

  • 左上隅が (100,100) の 2 番目の四角形を作成し、クリッピング領域をこの四角形と現在のクリッピング領域 (最初の四角形) の交差部分に設定します。

  • 前の両方の四角形を含む大きな四角形に、青い実線のブラシを塗りつぶします。

  • クリッピング領域を無限にリセットします。

  • 2 つのクリッピング領域の周りに四角形を描画します。 最初のクリッピング四角形には黒いペンを使用し、2 番目のクリッピング領域には赤いペンを使用します。

結果として、2 つの四角形の交差部分のみが青で塗りつぶされます。

public:
   void IntersectClipRectangleF1( PaintEventArgs^ e )
   {
      // Set clipping region.
      Rectangle clipRect = Rectangle(0,0,200,200);
      e->Graphics->SetClip( clipRect );

      // Update clipping region to intersection of
      // existing region with specified rectangle.
      RectangleF intersectRectF = RectangleF(100.0F,100.0F,200.0F,200.0F);
      e->Graphics->IntersectClip( intersectRectF );

      // Fill rectangle to demonstrate effective clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 );

      // Reset clipping region to infinite.
      e->Graphics->ResetClip();

      // Draw clipRect and intersectRect to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect );
      e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), Rectangle::Round( intersectRectF ) );
   }
private void IntersectClipRectangleF1(PaintEventArgs e)
{

    // Set clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 200, 200);
    e.Graphics.SetClip(clipRect);

    // Update clipping region to intersection of

    // existing region with specified rectangle.
    RectangleF intersectRectF = new RectangleF(100.0F, 100.0F, 200.0F, 200.0F);
    e.Graphics.IntersectClip(intersectRectF);

    // Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);

    // Reset clipping region to infinite.
    e.Graphics.ResetClip();

    // Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
    e.Graphics.DrawRectangle(new Pen(Color.Red), Rectangle.Round(intersectRectF));
}
Private Sub IntersectClipRectangleF1(ByVal e As PaintEventArgs)

    ' Set clipping region.
    Dim clipRect As New Rectangle(0, 0, 200, 200)
    e.Graphics.SetClip(clipRect)

    ' Update clipping region to intersection of

    ' existing region with specified rectangle.
    Dim intersectRectF As New RectangleF(100.0F, 100.0F, 200.0F, 200.0F)
    e.Graphics.IntersectClip(intersectRectF)

    ' Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    500, 500)

    ' Reset clipping region to infinite.
    e.Graphics.ResetClip()

    ' Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Black), clipRect)
    e.Graphics.DrawRectangle(New Pen(Color.Red), _
    Rectangle.Round(intersectRectF))
End Sub

注釈

このメソッドは、現在のクリップ領域と パラメーターで指定された四角形の積集合で表される領域を、このGraphicsプロパティにrect割り当てますClip

適用対象

IntersectClip(Region)

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

この Graphics のクリップ領域を現在のクリップ領域と指定した Region との交差部分に更新します。

public:
 void IntersectClip(System::Drawing::Region ^ region);
public void IntersectClip (System.Drawing.Region region);
member this.IntersectClip : System.Drawing.Region -> unit
Public Sub IntersectClip (region As Region)

パラメーター

region
Region

現在の領域と交差する Region

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

  • 左上隅が (0,0) の四角形を作成します。

  • 領域を作成し、それを四角形に設定し、クリッピング領域をこの領域に設定します。

  • 左上隅が (100、100) の 2 番目の四角形を作成します。

  • 領域を作成し、2 番目の四角形に設定し、 の結合モードを使用して、この領域と現在のクリッピング領域 (最初の四角形) の Replace交差部分にクリッピング領域を設定します。

  • 前の領域の両方を含む大きな四角形に、青い純色のブラシを塗りつぶします。

  • クリッピング領域を無限にリセットします。

  • 2 つのクリッピング領域の周りに四角形を描画します。 最初のクリッピング領域には黒いペンを使用し、2 番目のクリッピング領域には赤いペンを使用します。

結果として、2 つの領域の交差部分のみが青で塗りつぶされます。

public:
   void IntersectClipRegion( PaintEventArgs^ e )
   {
      // Set clipping region.
      Rectangle clipRect = Rectangle(0,0,200,200);
      System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( clipRect );
      e->Graphics->SetClip( clipRegion, CombineMode::Replace );

      // Update clipping region to intersection of
      // existing region with specified rectangle.
      Rectangle intersectRect = Rectangle(100,100,200,200);
      System::Drawing::Region^ intersectRegion = gcnew System::Drawing::Region( intersectRect );
      e->Graphics->IntersectClip( intersectRegion );

      // Fill rectangle to demonstrate effective clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 );

      // Reset clipping region to infinite.
      e->Graphics->ResetClip();

      // Draw clipRect and intersectRect to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect );
      e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect );
   }
private void IntersectClipRegion(PaintEventArgs e)
{

    // Set clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 200, 200);
    Region clipRegion = new Region(clipRect);
    e.Graphics.SetClip(clipRegion, CombineMode.Replace);

    // Update clipping region to intersection of

    // existing region with specified rectangle.
    Rectangle intersectRect = new Rectangle(100, 100, 200, 200);
    Region intersectRegion = new Region(intersectRect);
    e.Graphics.IntersectClip(intersectRegion);

    // Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);

    // Reset clipping region to infinite.
    e.Graphics.ResetClip();

    // Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
    e.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);
}
Private Sub IntersectClipRegion(ByVal e As PaintEventArgs)

    ' Set clipping region.
    Dim clipRect As New Rectangle(0, 0, 200, 200)
    Dim clipRegion As New [Region](clipRect)
    e.Graphics.SetClip(clipRegion, CombineMode.Replace)

    ' Update clipping region to intersection of

    ' existing region with specified rectangle.
    Dim intersectRect As New Rectangle(100, 100, 200, 200)
    Dim intersectRegion As New [Region](intersectRect)
    e.Graphics.IntersectClip(intersectRegion)

    ' Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    500, 500)

    ' Reset clipping region to infinite.
    e.Graphics.ResetClip()

    ' Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Black), clipRect)
    e.Graphics.DrawRectangle(New Pen(Color.Red), intersectRect)
End Sub

注釈

このメソッドは、現在のクリップ領域と パラメーターで指定された領域の積集合で表される領域を、このGraphicsプロパティにregion割り当てますClip

適用対象