Region.Intersect Metodo

Definizione

Aggiorna l'oggetto Region all'intersezione di se stesso con l'oggetto specificato Region.

Overload

Nome Descrizione
Intersect(GraphicsPath)

Aggiorna l'oggetto Region all'intersezione di se stesso con l'oggetto specificato GraphicsPath.

Intersect(Rectangle)

Aggiorna questa Region proprietà all'intersezione di se stessa con la struttura specificata Rectangle .

Intersect(RectangleF)

Aggiorna questa Region proprietà all'intersezione di se stessa con la struttura specificata RectangleF .

Intersect(Region)

Aggiorna l'oggetto Region all'intersezione di se stesso con l'oggetto specificato Region.

Intersect(GraphicsPath)

Aggiorna l'oggetto Region all'intersezione di se stesso con l'oggetto specificato GraphicsPath.

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 questo Regionoggetto .

Esempio

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

Si applica a

Intersect(Rectangle)

Aggiorna questa Region proprietà all'intersezione di se stessa con la struttura specificata Rectangle .

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 questo Regionoggetto .

Esempio

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

Si applica a

Intersect(RectangleF)

Aggiorna questa Region proprietà all'intersezione di se stessa con la struttura specificata RectangleF .

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 questo Regionoggetto .

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, che è un parametro del gestore eventi Paint. 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 quando combinata 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)

Aggiorna l'oggetto Region all'intersezione di se stesso con l'oggetto specificato Region.

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 questo Regionoggetto .

Esempio

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

Si applica a