Region.IsVisible Region.IsVisible Region.IsVisible Region.IsVisible Method

Definition

Tests whether the specified rectangle is contained within this Region.

Overloads

IsVisible(Single, Single, Single, Single, Graphics) IsVisible(Single, Single, Single, Single, Graphics) IsVisible(Single, Single, Single, Single, Graphics) IsVisible(Single, Single, Single, Single, Graphics)

Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified Graphics.

IsVisible(Int32, Int32, Int32, Int32, Graphics) IsVisible(Int32, Int32, Int32, Int32, Graphics) IsVisible(Int32, Int32, Int32, Int32, Graphics) IsVisible(Int32, Int32, Int32, Int32, Graphics)

Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified Graphics.

IsVisible(Single, Single, Single, Single) IsVisible(Single, Single, Single, Single) IsVisible(Single, Single, Single, Single) IsVisible(Single, Single, Single, Single)

Tests whether any portion of the specified rectangle is contained within this Region.

IsVisible(Int32, Int32, Int32, Int32) IsVisible(Int32, Int32, Int32, Int32) IsVisible(Int32, Int32, Int32, Int32) IsVisible(Int32, Int32, Int32, Int32)

Tests whether any portion of the specified rectangle is contained within this Region.

IsVisible(Single, Single, Graphics) IsVisible(Single, Single, Graphics) IsVisible(Single, Single, Graphics) IsVisible(Single, Single, Graphics)

Tests whether the specified point is contained within this Region when drawn using the specified Graphics.

IsVisible(Int32, Int32, Graphics) IsVisible(Int32, Int32, Graphics) IsVisible(Int32, Int32, Graphics) IsVisible(Int32, Int32, Graphics)

Tests whether the specified point is contained within this Region object when drawn using the specified Graphics object.

IsVisible(Single, Single) IsVisible(Single, Single) IsVisible(Single, Single) IsVisible(Single, Single)

Tests whether the specified point is contained within this Region.

IsVisible(Point) IsVisible(Point) IsVisible(Point)

Tests whether the specified Point structure is contained within this Region.

IsVisible(Rectangle, Graphics) IsVisible(Rectangle, Graphics) IsVisible(Rectangle, Graphics) IsVisible(Rectangle, Graphics)

Tests whether any portion of the specified Rectangle structure is contained within this Region when drawn using the specified Graphics.

IsVisible(PointF, Graphics) IsVisible(PointF, Graphics) IsVisible(PointF, Graphics) IsVisible(PointF, Graphics)

Tests whether the specified PointF structure is contained within this Region when drawn using the specified Graphics.

IsVisible(Point, Graphics) IsVisible(Point, Graphics) IsVisible(Point, Graphics)

Tests whether the specified Point structure is contained within this Region when drawn using the specified Graphics.

IsVisible(RectangleF) IsVisible(RectangleF) IsVisible(RectangleF) IsVisible(RectangleF)

Tests whether any portion of the specified RectangleF structure is contained within this Region.

IsVisible(Rectangle) IsVisible(Rectangle) IsVisible(Rectangle) IsVisible(Rectangle)

Tests whether any portion of the specified Rectangle structure is contained within this Region.

IsVisible(PointF) IsVisible(PointF) IsVisible(PointF) IsVisible(PointF)

Tests whether the specified PointF structure is contained within this Region.

IsVisible(RectangleF, Graphics) IsVisible(RectangleF, Graphics) IsVisible(RectangleF, Graphics) IsVisible(RectangleF, Graphics)

Tests whether any portion of the specified RectangleF structure is contained within this Region when drawn using the specified Graphics.

IsVisible(Single, Single, Single, Single, Graphics) IsVisible(Single, Single, Single, Single, Graphics) IsVisible(Single, Single, Single, Single, Graphics) IsVisible(Single, Single, Single, Single, Graphics)

Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified Graphics.

public:
 bool IsVisible(float x, float y, float width, float height, System::Drawing::Graphics ^ g);
public bool IsVisible (float x, float y, float width, float height, System.Drawing.Graphics g);
member this.IsVisible : single * single * single * single * System.Drawing.Graphics -> bool
Public Function IsVisible (x As Single, y As Single, width As Single, height As Single, g As Graphics) As Boolean

Parameters

x
Single Single Single Single

The x-coordinate of the upper-left corner of the rectangle to test.

y
Single Single Single Single

The y-coordinate of the upper-left corner of the rectangle to test.

width
Single Single Single Single

The width of the rectangle to test.

height
Single Single Single Single

The height of the rectangle to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when any portion of the specified rectangle is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the rectangle coordinates on the drawing surface.

IsVisible(Int32, Int32, Int32, Int32, Graphics) IsVisible(Int32, Int32, Int32, Int32, Graphics) IsVisible(Int32, Int32, Int32, Int32, Graphics) IsVisible(Int32, Int32, Int32, Int32, Graphics)

Tests whether any portion of the specified rectangle is contained within this Region when drawn using the specified Graphics.

public:
 bool IsVisible(int x, int y, int width, int height, System::Drawing::Graphics ^ g);
public bool IsVisible (int x, int y, int width, int height, System.Drawing.Graphics g);
member this.IsVisible : int * int * int * int * System.Drawing.Graphics -> bool
Public Function IsVisible (x As Integer, y As Integer, width As Integer, height As Integer, g As Graphics) As Boolean

Parameters

x
Int32 Int32 Int32 Int32

The x-coordinate of the upper-left corner of the rectangle to test.

y
Int32 Int32 Int32 Int32

The y-coordinate of the upper-left corner of the rectangle to test.

width
Int32 Int32 Int32 Int32

The width of the rectangle to test.

height
Int32 Int32 Int32 Int32

The height of the rectangle to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when any portion of the specified rectangle is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the rectangle coordinates on the drawing surface.

IsVisible(Single, Single, Single, Single) IsVisible(Single, Single, Single, Single) IsVisible(Single, Single, Single, Single) IsVisible(Single, Single, Single, Single)

Tests whether any portion of the specified rectangle is contained within this Region.

public:
 bool IsVisible(float x, float y, float width, float height);
public bool IsVisible (float x, float y, float width, float height);
member this.IsVisible : single * single * single * single -> bool
Public Function IsVisible (x As Single, y As Single, width As Single, height As Single) As Boolean

Parameters

x
Single Single Single Single

The x-coordinate of the upper-left corner of the rectangle to test.

y
Single Single Single Single

The y-coordinate of the upper-left corner of the rectangle to test.

width
Single Single Single Single

The width of the rectangle to test.

height
Single Single Single Single

The height of the rectangle to test.

Returns

true when any portion of the specified rectangle is contained within this Region object; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

IsVisible(Int32, Int32, Int32, Int32) IsVisible(Int32, Int32, Int32, Int32) IsVisible(Int32, Int32, Int32, Int32) IsVisible(Int32, Int32, Int32, Int32)

Tests whether any portion of the specified rectangle is contained within this Region.

public:
 bool IsVisible(int x, int y, int width, int height);
public bool IsVisible (int x, int y, int width, int height);
member this.IsVisible : int * int * int * int -> bool
Public Function IsVisible (x As Integer, y As Integer, width As Integer, height As Integer) As Boolean

Parameters

x
Int32 Int32 Int32 Int32

The x-coordinate of the upper-left corner of the rectangle to test.

y
Int32 Int32 Int32 Int32

The y-coordinate of the upper-left corner of the rectangle to test.

width
Int32 Int32 Int32 Int32

The width of the rectangle to test.

height
Int32 Int32 Int32 Int32

The height of the rectangle to test.

Returns

true when any portion of the specified rectangle is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

IsVisible(Single, Single, Graphics) IsVisible(Single, Single, Graphics) IsVisible(Single, Single, Graphics) IsVisible(Single, Single, Graphics)

Tests whether the specified point is contained within this Region when drawn using the specified Graphics.

public:
 bool IsVisible(float x, float y, System::Drawing::Graphics ^ g);
public bool IsVisible (float x, float y, System.Drawing.Graphics g);
member this.IsVisible : single * single * System.Drawing.Graphics -> bool
Public Function IsVisible (x As Single, y As Single, g As Graphics) As Boolean

Parameters

x
Single Single Single Single

The x-coordinate of the point to test.

y
Single Single Single Single

The y-coordinate of the point to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when the specified point is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the point coordinates on the drawing surface.

IsVisible(Int32, Int32, Graphics) IsVisible(Int32, Int32, Graphics) IsVisible(Int32, Int32, Graphics) IsVisible(Int32, Int32, Graphics)

Tests whether the specified point is contained within this Region object when drawn using the specified Graphics object.

public:
 bool IsVisible(int x, int y, System::Drawing::Graphics ^ g);
public bool IsVisible (int x, int y, System.Drawing.Graphics g);
member this.IsVisible : int * int * System.Drawing.Graphics -> bool
Public Function IsVisible (x As Integer, y As Integer, g As Graphics) As Boolean

Parameters

x
Int32 Int32 Int32 Int32

The x-coordinate of the point to test.

y
Int32 Int32 Int32 Int32

The y-coordinate of the point to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when the specified point is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the point coordinates on the drawing surface.

IsVisible(Single, Single) IsVisible(Single, Single) IsVisible(Single, Single) IsVisible(Single, Single)

Tests whether the specified point is contained within this Region.

public:
 bool IsVisible(float x, float y);
public bool IsVisible (float x, float y);
member this.IsVisible : single * single -> bool
Public Function IsVisible (x As Single, y As Single) As Boolean

Parameters

x
Single Single Single Single

The x-coordinate of the point to test.

y
Single Single Single Single

The y-coordinate of the point to test.

Returns

true when the specified point is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

IsVisible(Point) IsVisible(Point) IsVisible(Point)

Tests whether the specified Point structure is contained within this Region.

public:
 bool IsVisible(System::Drawing::Point point);
public bool IsVisible (System.Drawing.Point point);
member this.IsVisible : System.Drawing.Point -> bool

Parameters

point
Point Point Point Point

The Point structure to test.

Returns

true when point is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

IsVisible(Rectangle, Graphics) IsVisible(Rectangle, Graphics) IsVisible(Rectangle, Graphics) IsVisible(Rectangle, Graphics)

Tests whether any portion of the specified Rectangle structure is contained within this Region when drawn using the specified Graphics.

public:
 bool IsVisible(System::Drawing::Rectangle rect, System::Drawing::Graphics ^ g);
public bool IsVisible (System.Drawing.Rectangle rect, System.Drawing.Graphics g);
member this.IsVisible : System.Drawing.Rectangle * System.Drawing.Graphics -> bool
Public Function IsVisible (rect As Rectangle, g As Graphics) As Boolean

Parameters

rect
Rectangle Rectangle Rectangle Rectangle

The Rectangle structure to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when any portion of the rect is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the rectangle coordinates on the drawing surface.

IsVisible(PointF, Graphics) IsVisible(PointF, Graphics) IsVisible(PointF, Graphics) IsVisible(PointF, Graphics)

Tests whether the specified PointF structure is contained within this Region when drawn using the specified Graphics.

public:
 bool IsVisible(System::Drawing::PointF point, System::Drawing::Graphics ^ g);
public bool IsVisible (System.Drawing.PointF point, System.Drawing.Graphics g);
member this.IsVisible : System.Drawing.PointF * System.Drawing.Graphics -> bool
Public Function IsVisible (point As PointF, g As Graphics) As Boolean

Parameters

point
PointF PointF PointF PointF

The PointF structure to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when point is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the point coordinates on the drawing surface.

IsVisible(Point, Graphics) IsVisible(Point, Graphics) IsVisible(Point, Graphics)

Tests whether the specified Point structure is contained within this Region when drawn using the specified Graphics.

public:
 bool IsVisible(System::Drawing::Point point, System::Drawing::Graphics ^ g);
public bool IsVisible (System.Drawing.Point point, System.Drawing.Graphics g);
member this.IsVisible : System.Drawing.Point * System.Drawing.Graphics -> bool

Parameters

point
Point Point Point Point

The Point structure to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when point is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the point coordinates on the drawing surface.

IsVisible(RectangleF) IsVisible(RectangleF) IsVisible(RectangleF) IsVisible(RectangleF)

Tests whether any portion of the specified RectangleF structure is contained within this Region.

public:
 bool IsVisible(System::Drawing::RectangleF rect);
public bool IsVisible (System.Drawing.RectangleF rect);
member this.IsVisible : System.Drawing.RectangleF -> bool
Public Function IsVisible (rect As RectangleF) As Boolean

Parameters

rect
RectangleF RectangleF RectangleF RectangleF

The RectangleF structure to test.

Returns

true when any portion of rect is contained within this Region; otherwise, false.

Examples

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates the first rectangle and draws it to the screen in blue.

  • Creates the second rectangle and draws it to the screen in red.

  • Creates a region from the first rectangle.

  • Determines if any portion of the rectangle intersects with the region.

  • Displays the true or false result on the screen.

Notice that the rectangle intersects the region, so the result is true.

public:
   void IsVisible_RectF_Example( PaintEventArgs^ e )
   {
      // Create the first rectangle and draw it to the screen in blue.
      Rectangle regionRect = Rectangle(20,20,100,100);
      e->Graphics->DrawRectangle( Pens::Blue, regionRect );

      // Create the second rectangle and draw it to the screen in red.
      RectangleF myRect = RectangleF(90,30,100,100);
      e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( myRect ) );

      // Create a region using the first rectangle.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );

      // Determine if myRect is contained in the region.
      bool contained = myRegion->IsVisible( myRect );

      // Display the result.
      System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 );
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Black );
      e->Graphics->DrawString( String::Format( "contained = {0}", contained ), myFont, myBrush, PointF(20,140) );
   }
public void IsVisible_RectF_Example(PaintEventArgs e)
{
             
    // Create the first rectangle and draw it to the screen in blue.
    Rectangle regionRect = new Rectangle(20, 20, 100, 100);
    e.Graphics.DrawRectangle(Pens.Blue, regionRect);
             
    // Create the second rectangle and draw it to the screen in red.
    RectangleF myRect = new RectangleF(90, 30, 100, 100);
    e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(myRect));
             
    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Determine if myRect is contained in the region.
    bool contained = myRegion.IsVisible(myRect);
             
    // Display the result.
    Font myFont = new Font("Arial", 8);
    SolidBrush myBrush = new SolidBrush(Color.Black);
    e.Graphics.DrawString("contained = " + contained.ToString(),
        myFont,
        myBrush,
        new PointF(20, 140));
}
Public Sub IsVisible_RectF_Example(ByVal e As PaintEventArgs)

    ' Create the first rectangle and draw it to the screen in blue.
    Dim regionRect As New Rectangle(20, 20, 100, 100)
    e.Graphics.DrawRectangle(Pens.Blue, regionRect)

    ' create the second rectangle and draw it to the screen in red.
    Dim myRect As New RectangleF(90, 30, 100, 100)
    e.Graphics.DrawRectangle(Pens.Red, Rectangle.Round(myRect))

    ' Create a region using the first rectangle.
    Dim myRegion As New [Region](regionRect)

    ' Determine if myRect is contained in the region.
    Dim contained As Boolean = myRegion.IsVisible(myRect)

    ' Display the result.
    Dim myFont As New Font("Arial", 8)
    Dim myBrush As New SolidBrush(Color.Black)
    e.Graphics.DrawString("contained = " & contained.ToString(), _
    myFont, myBrush, New PointF(20, 140))
End Sub

IsVisible(Rectangle) IsVisible(Rectangle) IsVisible(Rectangle) IsVisible(Rectangle)

Tests whether any portion of the specified Rectangle structure is contained within this Region.

public:
 bool IsVisible(System::Drawing::Rectangle rect);
public bool IsVisible (System.Drawing.Rectangle rect);
member this.IsVisible : System.Drawing.Rectangle -> bool
Public Function IsVisible (rect As Rectangle) As Boolean

Parameters

rect
Rectangle Rectangle Rectangle Rectangle

The Rectangle structure to test.

Returns

This method returns true when any portion of rect is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

IsVisible(PointF) IsVisible(PointF) IsVisible(PointF) IsVisible(PointF)

Tests whether the specified PointF structure is contained within this Region.

public:
 bool IsVisible(System::Drawing::PointF point);
public bool IsVisible (System.Drawing.PointF point);
member this.IsVisible : System.Drawing.PointF -> bool
Public Function IsVisible (point As PointF) As Boolean

Parameters

point
PointF PointF PointF PointF

The PointF structure to test.

Returns

true when point is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

IsVisible(RectangleF, Graphics) IsVisible(RectangleF, Graphics) IsVisible(RectangleF, Graphics) IsVisible(RectangleF, Graphics)

Tests whether any portion of the specified RectangleF structure is contained within this Region when drawn using the specified Graphics.

public:
 bool IsVisible(System::Drawing::RectangleF rect, System::Drawing::Graphics ^ g);
public bool IsVisible (System.Drawing.RectangleF rect, System.Drawing.Graphics g);
member this.IsVisible : System.Drawing.RectangleF * System.Drawing.Graphics -> bool
Public Function IsVisible (rect As RectangleF, g As Graphics) As Boolean

Parameters

rect
RectangleF RectangleF RectangleF RectangleF

The RectangleF structure to test.

g
Graphics Graphics Graphics Graphics

A Graphics that represents a graphics context.

Returns

true when rect is contained within this Region; otherwise, false.

Examples

For a code example, see the IsVisible(RectangleF) method.

Remarks

The current transformation of the graphics context is used to compute the region interior and the rectangle coordinates on the drawing surface.

Applies to