Region.Intersect Metodo

Definizione

Aggiorna questa istanza di Region con la sua intersezione con l'oggetto Region specificato.

Overload

Intersect(GraphicsPath)

Aggiorna questa istanza di Region con la sua intersezione con l'oggetto GraphicsPath specificato.

Intersect(Rectangle)

Aggiorna questa istanza di Region con la sua intersezione con la struttura Rectangle specificata.

Intersect(RectangleF)

Aggiorna questa istanza di Region con la sua intersezione con la struttura RectangleF specificata.

Intersect(Region)

Aggiorna questa istanza di Region con la sua intersezione con l'oggetto Region specificato.

Intersect(GraphicsPath)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa istanza di Region con la sua intersezione con l'oggetto GraphicsPath specificato.

public:
 void Intersect(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void Intersect (System.Drawing.Drawing2D.GraphicsPath path);
member this.Intersect : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub Intersect (path As GraphicsPath)

Parametri

path
GraphicsPath

Oggetto GraphicsPath da intersecare con questa istanza di Region.

Esempio

Per esempi di codice, vedere i RectangleF.Intersect(RectangleF) metodi e Complement(GraphicsPath) .

Si applica a

Intersect(Rectangle)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa istanza di Region con la sua intersezione con la struttura Rectangle specificata.

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

Parametri

rect
Rectangle

Struttura Rectangle da intersecare con questa istanza di Region.

Esempio

Per un esempio di codice, vedere il Intersect(RectangleF) metodo .

Si applica a

Intersect(RectangleF)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa istanza di Region con la sua intersezione con la struttura RectangleF specificata.

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

Parametri

rect
RectangleF

Struttura RectangleF da intersecare con questa istanza di Region.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del Paint gestore eventi. Il codice esegue le azioni seguenti:

  • Crea il primo rettangolo e lo disegna sullo schermo in nero.

  • Crea il secondo rettangolo e lo disegna sullo schermo in rosso.

  • Crea un'area dal primo rettangolo.

  • Ottiene l'area di intersezione per l'area in combinazione con il secondo rettangolo.

  • Riempie l'area di intersezione con blu e la disegna sullo schermo.

Si noti che solo l'area sovrapposta per l'area e il rettangolo è blu.

public:
   void Intersect_RectF_Example( PaintEventArgs^ e )
   {
      // Create the first rectangle and draw it to the screen in black.
      Rectangle regionRect = Rectangle(20,20,100,100);
      e->Graphics->DrawRectangle( Pens::Black, regionRect );

      // create the second rectangle and draw it to the screen in red.
      RectangleF complementRect = RectangleF(90,30,100,100);
      e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) );

      // Create a region using the first rectangle.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );

      // Get the area of intersection for myRegion when combined with
      // complementRect.
      myRegion->Intersect( complementRect );

      // Fill the intersection area of myRegion with blue.
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
      e->Graphics->FillRegion( myBrush, myRegion );
   }
public void Intersect_RectF_Example(PaintEventArgs e)
{
             
    // Create the first rectangle and draw it to the screen in black.
    Rectangle regionRect = new Rectangle(20, 20, 100, 100);
    e.Graphics.DrawRectangle(Pens.Black, regionRect);
             
    // create the second rectangle and draw it to the screen in red.
    RectangleF complementRect = new RectangleF(90, 30, 100, 100);
    e.Graphics.DrawRectangle(Pens.Red,
        Rectangle.Round(complementRect));
             
    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Get the area of intersection for myRegion when combined with
             
    // complementRect.
    myRegion.Intersect(complementRect);
             
    // Fill the intersection area of myRegion with blue.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Intersect_RectF_Example(ByVal e As PaintEventArgs)

    ' Create the first rectangle and draw it to the screen in black.
    Dim regionRect As New Rectangle(20, 20, 100, 100)
    e.Graphics.DrawRectangle(Pens.Black, regionRect)

    ' create the second rectangle and draw it to the screen in red.
    Dim complementRect As New RectangleF(90, 30, 100, 100)
    e.Graphics.DrawRectangle(Pens.Red, _
    Rectangle.Round(complementRect))

    ' Create a region using the first rectangle.
    Dim myRegion As New [Region](regionRect)

    ' Get the area of intersection for myRegion when combined with
    ' complementRect.
    myRegion.Intersect(complementRect)

    ' Fill the intersection area of myRegion with blue.
    Dim myBrush As New SolidBrush(Color.Blue)
    e.Graphics.FillRegion(myBrush, myRegion)
End Sub

Si applica a

Intersect(Region)

Origine:
Region.cs
Origine:
Region.cs
Origine:
Region.cs

Aggiorna questa istanza di Region con la sua intersezione con l'oggetto Region specificato.

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

Parametri

region
Region

Oggetto Region da intersecare con questa istanza di Region.

Esempio

Per esempi di codice, vedere il Intersect(RectangleF) metodo e Complement(GraphicsPath).

Si applica a