Region.MakeInfinite 方法

将此 Region 对象初始化为无限内部。

**命名空间:**System.Drawing
**程序集:**System.Drawing(在 system.drawing.dll 中)

语法

声明
Public Sub MakeInfinite
用法
Dim instance As Region

instance.MakeInfinite
public void MakeInfinite ()
public:
void MakeInfinite ()
public void MakeInfinite ()
public function MakeInfinite ()

示例

下面的代码示例说明如何使用 MakeInfinite 方法。此示例是针对使用 Windows 窗体而设计的。创建一个窗体,并将下面的代码粘贴到其中。在该窗体的 Paint 事件处理方法中调用 FillEmptyRegion 方法,并将 e 作为 PaintEventArgs 传递。

Private Sub FillInfiniteRegion(ByVal e As PaintEventArgs)
    ' Create a region from a rectangle.
    Dim originalRectangle As New Rectangle(40, 40, 40, 50)
    Dim smallRegion As New Region(originalRectangle)

    ' Call MakeInfinite.
    smallRegion.MakeInfinite()

    ' Fill the region in red and draw the original rectangle
    ' in black. Note that the entire form is filled in.
    e.Graphics.FillRegion(Brushes.Red, smallRegion)
    e.Graphics.DrawRectangle(Pens.Black, originalRectangle)

End Sub
private void FillInfiniteRegion(PaintEventArgs e)
{
    // Create a region from a rectangle.
    Rectangle originalRectangle = new Rectangle(40, 40, 40, 50);
    Region smallRegion = new Region(originalRectangle);

    // Call MakeInfinite.
    smallRegion.MakeInfinite();

    // Fill the region in red and draw the original rectangle
    // in black. Note that the entire form is filled in.
    e.Graphics.FillRegion(Brushes.Red, smallRegion);
    e.Graphics.DrawRectangle(Pens.Black, originalRectangle);

}
private:
   void FillInfiniteRegion( PaintEventArgs^ e )
   {
      // Create a region from a rectangle.
      Rectangle originalRectangle = Rectangle(40,40,40,50);
      System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle );

      // Call MakeInfinite.
      smallRegion->MakeInfinite();

      // Fill the region in red and draw the original rectangle
      // in black. Note that the entire form is filled in.
      e->Graphics->FillRegion( Brushes::Red, smallRegion );
      e->Graphics->DrawRectangle( Pens::Black, originalRectangle );
   }
private void FillInfiniteRegion(PaintEventArgs e)
{
    // Create a region from a rectangle.
    Rectangle originalRectangle = new Rectangle(40, 40, 40, 50);
    Region smallRegion = new Region(originalRectangle);

    // Call MakeInfinite.
    smallRegion.MakeInfinite();

    // Fill the region in red and draw the original rectangle
    // in black. Note that the entire form is filled in.
    e.get_Graphics().FillRegion(Brushes.get_Red(), smallRegion);
    e.get_Graphics().DrawRectangle(Pens.get_Black(), originalRectangle);
} //FillInfiniteRegion

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Region 类
Region 成员
System.Drawing 命名空间