Region.IsVisible 方法

定义

测试指定矩形是否包含在此 Region 中。

重载

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

测试指定的矩形在使用指定的 Region 绘制后是否有任何部分包含在此 Graphics 中。

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

测试指定的矩形在使用指定的 Region 绘制后是否有任何部分包含在此 Graphics 中。

IsVisible(Single, Single, Single, Single)

测试指定的矩形是否有任何部分包含在此 Region 中。

IsVisible(Int32, Int32, Int32, Int32)

测试指定的矩形是否有任何部分包含在此 Region 中。

IsVisible(Single, Single, Graphics)

测试指定点在使用指定的 Region 绘制后是否包含在此 Graphics 中。

IsVisible(Int32, Int32, Graphics)

测试指定的点在用指定的 Region 对象绘制时是否包含在此 Graphics 对象内。

IsVisible(Single, Single)

测试指定点是否包含在此 Region 中。

IsVisible(Point)

测试指定 Point 结构是否包含在此 Region 中。

IsVisible(Rectangle, Graphics)

测试指定的 Rectangle 结构在使用指定的 Region 绘制后是否有任何部分包含在此 Graphics 中。

IsVisible(PointF, Graphics)

测试指定的 PointF 结构在使用指定的 Region 绘制后是否包含在此 Graphics 中。

IsVisible(Point, Graphics)

测试指定的 Point 结构在使用指定的 Region 绘制后是否包含在此 Graphics 中。

IsVisible(RectangleF)

测试指定的 RectangleF 结构是否有任何部分包含在此 Region 中。

IsVisible(Rectangle)

测试指定的 Rectangle 结构是否有任何部分包含在此 Region 中。

IsVisible(PointF)

测试指定 PointF 结构是否包含在此 Region 中。

IsVisible(RectangleF, Graphics)

测试指定的 RectangleF 结构在使用指定的 Region 绘制后是否有任何部分包含在此 Graphics 中。

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

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的矩形在使用指定的 Region 绘制后是否有任何部分包含在此 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);
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

参数

x
Single

要测试的矩形的左上角的 x 坐标。

y
Single

要测试的矩形的左上角的 y 坐标。

width
Single

要测试的矩形的宽度。

height
Single

要测试的矩形的高度。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果指定的矩形有任何部分包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和矩形坐标。

适用于

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

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的矩形在使用指定的 Region 绘制后是否有任何部分包含在此 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);
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

参数

x
Int32

要测试的矩形的左上角的 x 坐标。

y
Int32

要测试的矩形的左上角的 y 坐标。

width
Int32

要测试的矩形的宽度。

height
Int32

要测试的矩形的高度。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果指定的矩形有任何部分包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和矩形坐标。

适用于

IsVisible(Single, Single, Single, Single)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的矩形是否有任何部分包含在此 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

参数

x
Single

要测试的矩形的左上角的 x 坐标。

y
Single

要测试的矩形的左上角的 y 坐标。

width
Single

要测试的矩形的宽度。

height
Single

要测试的矩形的高度。

返回

如果指定的矩形有任何部分包含在此 Region 对象中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

适用于

IsVisible(Int32, Int32, Int32, Int32)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的矩形是否有任何部分包含在此 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

参数

x
Int32

要测试的矩形的左上角的 x 坐标。

y
Int32

要测试的矩形的左上角的 y 坐标。

width
Int32

要测试的矩形的宽度。

height
Int32

要测试的矩形的高度。

返回

如果指定的矩形有任何部分包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

适用于

IsVisible(Single, Single, Graphics)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定点在使用指定的 Region 绘制后是否包含在此 Graphics 中。

public:
 bool IsVisible(float x, float y, System::Drawing::Graphics ^ g);
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

参数

x
Single

要测试的点的 X 坐标。

y
Single

要测试的点的 Y 坐标。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果指定点包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和点坐标。

适用于

IsVisible(Int32, Int32, Graphics)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的点在用指定的 Region 对象绘制时是否包含在此 Graphics 对象内。

public:
 bool IsVisible(int x, int y, System::Drawing::Graphics ^ g);
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

参数

x
Int32

要测试的点的 X 坐标。

y
Int32

要测试的点的 Y 坐标。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果指定点包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和点坐标。

适用于

IsVisible(Single, Single)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定点是否包含在此 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

参数

x
Single

要测试的点的 X 坐标。

y
Single

要测试的点的 Y 坐标。

返回

如果指定点包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

适用于

IsVisible(Point)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定 Point 结构是否包含在此 Region 中。

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

参数

point
Point

要测试的 Point 结构。

返回

如果 point 包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

适用于

IsVisible(Rectangle, Graphics)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的 Rectangle 结构在使用指定的 Region 绘制后是否有任何部分包含在此 Graphics 中。

public:
 bool IsVisible(System::Drawing::Rectangle rect, System::Drawing::Graphics ^ g);
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

参数

rect
Rectangle

要测试的 Rectangle 结构。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果 rect 有任何部分包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和矩形坐标。

适用于

IsVisible(PointF, Graphics)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的 PointF 结构在使用指定的 Region 绘制后是否包含在此 Graphics 中。

public:
 bool IsVisible(System::Drawing::PointF point, System::Drawing::Graphics ^ g);
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

参数

point
PointF

要测试的 PointF 结构。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果 point 包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和点坐标。

适用于

IsVisible(Point, Graphics)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的 Point 结构在使用指定的 Region 绘制后是否包含在此 Graphics 中。

public:
 bool IsVisible(System::Drawing::Point point, System::Drawing::Graphics ^ g);
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
Public Function IsVisible (point As Point, g As Graphics) As Boolean

参数

point
Point

要测试的 Point 结构。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果 point 包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和点坐标。

适用于

IsVisible(RectangleF)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的 RectangleF 结构是否有任何部分包含在此 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

参数

rect
RectangleF

要测试的 RectangleF 结构。

返回

如果 rect 有任何部分包含在此 Region 中,将为 true;否则为 false

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse,它是 事件处理程序的Paint一个参数。 此代码执行以下操作:

  • 创建第一个矩形并将其绘制到蓝色屏幕。

  • 创建第二个矩形,并将其绘制到红色屏幕。

  • 从第一个矩形创建区域。

  • 确定矩形的任何部分是否与区域相交。

  • true在屏幕上显示 或 false 结果。

请注意,矩形与区域相交,因此结果为 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)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的 Rectangle 结构是否有任何部分包含在此 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

参数

rect
Rectangle

要测试的 Rectangle 结构。

返回

如果 rect 有任何部分包含在此 Region 中,此方法将返回 true;否则将返回 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

适用于

IsVisible(PointF)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定 PointF 结构是否包含在此 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

参数

point
PointF

要测试的 PointF 结构。

返回

如果 point 包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

适用于

IsVisible(RectangleF, Graphics)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

测试指定的 RectangleF 结构在使用指定的 Region 绘制后是否有任何部分包含在此 Graphics 中。

public:
 bool IsVisible(System::Drawing::RectangleF rect, System::Drawing::Graphics ^ g);
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

参数

rect
RectangleF

要测试的 RectangleF 结构。

g
Graphics

一个 Graphics,表示图形上下文。

返回

如果 rect 包含在此 Region 中,将为 true;否则为 false

示例

有关代码示例,请参阅 IsVisible(RectangleF) 方法。

注解

图形上下文的当前转换用于计算绘图图面上的区域内部和矩形坐标。

适用于