Region.MakeInfinite 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将此 Region 对象初始化为无限内部。
public:
void MakeInfinite();
public void MakeInfinite ();
member this.MakeInfinite : unit -> unit
Public Sub MakeInfinite ()
示例
下面的代码示例演示如何使用 MakeInfinite 方法。 此示例旨在与 Windows 窗体 一起使用。 Create窗体并将以下代码粘贴到其中。 FillEmptyRegion
在窗体的事件Paint处理方法中调用 方法,作为 e
PaintEventArgs传递。
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.Graphics.FillRegion(Brushes.Red, smallRegion);
e.Graphics.DrawRectangle(Pens.Black, originalRectangle);
}
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