Graphics.FillRegion(Brush, Region) Metoda

Definice

Vyplní vnitřek .Region

public:
 void FillRegion(System::Drawing::Brush ^ brush, System::Drawing::Region ^ region);
public void FillRegion (System.Drawing.Brush brush, System.Drawing.Region region);
member this.FillRegion : System.Drawing.Brush * System.Drawing.Region -> unit
Public Sub FillRegion (brush As Brush, region As Region)

Parametry

brush
Brush

Brush , která určuje charakteristiky výplně.

region
Region

Region představující oblast, která se má vyplnit.

Výjimky

brush je null.

-nebo-

region je null.

Příklady

Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akci:

  • Vytvoří plný modrý štětec.

  • Vytvoří obdélník.

  • Vytvoří obdélníkovou oblast.

  • Vyplní obdélníkovou oblast na obrazovce.

public:
   void FillRegionRectangle( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create rectangle for region.
      Rectangle fillRect = Rectangle(100,100,200,200);

      // Create region for fill.
      System::Drawing::Region^ fillRegion = gcnew System::Drawing::Region( fillRect );

      // Fill region to screen.
      e->Graphics->FillRegion( blueBrush, fillRegion );
   }
private void FillRegionRectangle(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create rectangle for region.
    Rectangle fillRect = new Rectangle(100, 100, 200, 200);

    // Create region for fill.
    Region fillRegion = new Region(fillRect);

    // Fill region to screen.
    e.Graphics.FillRegion(blueBrush, fillRegion);
}
Private Sub FillRegionRectangle(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create rectangle for region.
    Dim fillRect As New Rectangle(100, 100, 200, 200)

    ' Create region for fill.
    Dim fillRegion As New [Region](fillRect)

    ' Fill region to screen.
    e.Graphics.FillRegion(blueBrush, fillRegion)
End Sub

Poznámky

A Region se skládá z obdélníků a cest. Pokud oblast není uzavřena, přidá se další segment z posledního bodu do prvního bodu, který ho zavře.

Platí pro