Graphics.SetClip Metoda

Definicja

Ustawia region przycinania tego Graphics obiektu na Clip właściwość określonego Graphicsobiektu .

Przeciążenia

SetClip(Region, CombineMode)

Ustawia region przycinania tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i określony Regionelement .

SetClip(RectangleF, CombineMode)

Ustawia region wycinku tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i prostokąt określony przez RectangleF strukturę.

SetClip(Rectangle, CombineMode)

Ustawia region wycinku tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i prostokąt określony przez Rectangle strukturę.

SetClip(Graphics, CombineMode)

Ustawia region przycinania tego Graphics elementu na wynik określonej operacji łączenia bieżącego regionu klipu i Clip właściwości określonego Graphicsobiektu .

SetClip(RectangleF)

Ustawia region przycinania tego Graphics do prostokąta określonego RectangleF przez strukturę.

SetClip(Rectangle)

Ustawia region przycinania tego Graphics do prostokąta określonego Rectangle przez strukturę.

SetClip(Graphics)

Ustawia region przycinania tego Graphics obiektu na Clip właściwość określonego Graphicsobiektu .

SetClip(GraphicsPath)

Ustawia region przycinania tego Graphics elementu na określony GraphicsPathelement .

SetClip(GraphicsPath, CombineMode)

Ustawia region przycinania tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i określony GraphicsPathelement .

SetClip(Region, CombineMode)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region przycinania tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i określony Regionelement .

public:
 void SetClip(System::Drawing::Region ^ region, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Region region, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Region * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (region As Region, combineMode As CombineMode)

Parametry

region
Region

Region aby połączyć.

combineMode
CombineMode

Element członkowski z wyliczenia CombineMode , który określa operację łączenia do użycia.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy mały prostokąt dla regionu przycinania.

  • Ustawia region wycinka na prostokąt z elementem Replace członkowskim.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynikiem jest mały, wypełniony czarny prostokąt.

public:
   void SetClipRegionCombine( PaintEventArgs^ e )
   {
      // Create region for clipping.
      System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(0,0,100,100) );

      // Set clipping region of graphics to region.
      e->Graphics->SetClip( clipRegion, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRegionCombine(PaintEventArgs e)
{

    // Create region for clipping.
    Region clipRegion = new Region(new Rectangle(0, 0, 100, 100));

    // Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRegionCombine(ByVal e As PaintEventArgs)

    ' Create region for clipping.
    Dim clipRegion As New [Region](New Rectangle(0, 0, 100, 100))

    ' Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Dotyczy

SetClip(RectangleF, CombineMode)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region wycinku tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i prostokąt określony przez RectangleF strukturę.

public:
 void SetClip(System::Drawing::RectangleF rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.RectangleF rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.RectangleF * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As RectangleF, combineMode As CombineMode)

Parametry

rect
RectangleF

RectangleF struktura do łączenia.

combineMode
CombineMode

Element członkowski wyliczenia CombineMode , który określa operację łączenia do użycia.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy mały prostokąt dla regionu przycinania.

  • Ustawia region wycinka na prostokąt z elementem Replace członkowskim.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynikiem jest mały, wypełniony czarny prostokąt.

public:
   void SetClipRectangleFCombine( 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, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleFCombine(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, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleFCombine(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, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Dotyczy

SetClip(Rectangle, CombineMode)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region wycinku tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i prostokąt określony przez Rectangle strukturę.

public:
 void SetClip(System::Drawing::Rectangle rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Rectangle rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Rectangle * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As Rectangle, combineMode As CombineMode)

Parametry

rect
Rectangle

Rectangle struktura do łączenia.

combineMode
CombineMode

Element członkowski wyliczenia CombineMode , który określa operację łączenia do użycia.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy mały prostokąt dla regionu przycinania.

  • Ustawia region wycinka na prostokąt z elementem Replace członkowskim.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynikiem jest mały, wypełniony czarny prostokąt.

public:
   void SetClipRectangleCombine( 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, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleCombine(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, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleCombine(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, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Dotyczy

SetClip(Graphics, CombineMode)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region przycinania tego Graphics elementu na wynik określonej operacji łączenia bieżącego regionu klipu i Clip właściwości określonego Graphicsobiektu .

public:
 void SetClip(System::Drawing::Graphics ^ g, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Graphics g, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Graphics * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (g As Graphics, combineMode As CombineMode)

Parametry

g
Graphics

Graphics określa region klipu do połączenia.

combineMode
CombineMode

Element członkowski wyliczenia CombineMode , który określa operację łączenia do użycia.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń, a także thisFormForm parametru przykładu . Kod wykonuje następujące akcje:

  • Tworzy tymczasowy Graphics element z thisFormForm przykładu.

  • Ustawia region przycinania tymczasowego Graphics na mały kwadrat.

  • Aktualizacje obszar wycinka obiektu graficznego formularza do nowego Graphics elementu członkowskiegoReplace.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynik jest mały, wypełniony, czarny kwadrat.

public:
   void SetClipGraphicsCombine( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphicsCombine(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphicsCombine(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

Dotyczy

SetClip(RectangleF)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region przycinania tego Graphics do prostokąta określonego RectangleF przez strukturę.

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

Parametry

rect
RectangleF

RectangleF struktura reprezentująca nowy region klipu.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy mały prostokąt dla regionu przycinania.

  • Ustawia region przycinania na prostokąt.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynikiem jest mały, wypełniony czarny prostokąt.

public:
   void SetClipRectangleF( 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 );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleF(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);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleF(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)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Dotyczy

SetClip(Rectangle)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region przycinania tego Graphics do prostokąta określonego Rectangle przez strukturę.

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

Parametry

rect
Rectangle

Rectangle struktura reprezentująca nowy region klipu.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy mały prostokąt dla regionu przycinania.

  • Ustawia region przycinania na prostokąt.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynikiem jest mały, wypełniony czarny prostokąt.

public:
   void SetClipRectangle( 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 );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangle(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);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangle(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)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Dotyczy

SetClip(Graphics)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region przycinania tego Graphics obiektu na Clip właściwość określonego Graphicsobiektu .

public:
 void SetClip(System::Drawing::Graphics ^ g);
public void SetClip (System.Drawing.Graphics g);
member this.SetClip : System.Drawing.Graphics -> unit
Public Sub SetClip (g As Graphics)

Parametry

g
Graphics

Graphics z którego chcesz pobrać nowy region klipu.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń, a także thisFormForm parametru przykładu . Kod wykonuje następujące akcje:

  • Tworzy tymczasowy Graphics element z thisFormForm przykładu.

  • Ustawia region przycinania tymczasowego Graphics na mały kwadrat.

  • Aktualizacje obszar wycinkowy obiektu graficznego formularza do obiektu tymczasowego Graphics.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynik jest mały, wypełniony, czarny kwadrat.

public:
   void SetClipGraphics( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphics(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphics(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

Dotyczy

SetClip(GraphicsPath)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region przycinania tego Graphics elementu na określony GraphicsPathelement .

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

Parametry

path
GraphicsPath

GraphicsPath reprezentuje nowy region klipu.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy ścieżkę grafiki i dodaje wielokropek do ścieżki.

  • Ustawia region przycinania na ścieżkę wielokropkową.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynik jest wypełniony, czarny wielokropek.

public:
   void SetClipPath( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPath(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPath(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Uwagi

Jeśli ścieżka graficzna reprezentowana przez path parametr nie jest zamknięta, zostanie dodany dodatkowy segment od ostatniego punktu do pierwszego punktu, aby zamknąć ścieżkę.

Dotyczy

SetClip(GraphicsPath, CombineMode)

Źródło:
Graphics.cs
Źródło:
Graphics.cs
Źródło:
Graphics.cs

Ustawia region przycinania tego Graphics elementu na wynik określonej operacji łączącej bieżący region klipu i określony GraphicsPathelement .

public:
 void SetClip(System::Drawing::Drawing2D::GraphicsPath ^ path, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Drawing2D.GraphicsPath path, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Drawing2D.GraphicsPath * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (path As GraphicsPath, combineMode As CombineMode)

Parametry

path
GraphicsPath

GraphicsPath aby połączyć.

combineMode
CombineMode

Element członkowski wyliczenia CombineMode , który określa operację łączenia do użycia.

Przykłady

Poniższy przykład kodu jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgseparametru Paint programu obsługi zdarzeń. Kod wykonuje następujące akcje:

  • Tworzy ścieżkę grafiki i dodaje wielokropek do ścieżki.

  • Ustawia region wycinka na ścieżkę wielokropkową z elementem Replace członkowskim.

  • Wypełnia duży prostokąt solidnym czarnym pędzlem.

Wynik jest wypełniony, czarny wielokropek.

public:
   void SetClipPathCombine( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath, CombineMode::Replace );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPathCombine(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPathCombine(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

Uwagi

Jeśli ścieżka graficzna reprezentowana przez path parametr nie jest zamknięta, zostanie dodany dodatkowy segment od ostatniego punktu do pierwszego punktu, aby zamknąć ścieżkę.

Dotyczy