Region.IsVisible 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
测试指定的矩形是否包含在此 Region中。
重载
IsVisible(Single, Single, Single, Single, Graphics)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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
要测试的矩形的高度。
返回
在此 Region中包含指定矩形的任何部分时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和矩形坐标。
适用于
IsVisible(Int32, Int32, Int32, Int32, Graphics)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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
要测试的矩形的高度。
返回
在此 Region中包含指定矩形的任何部分时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和矩形坐标。
适用于
IsVisible(Single, Single, Single, Single)
- Source:
- Region.cs
- Source:
- Region.cs
- 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
- 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
- Source:
- Region.cs
- Source:
- Region.cs
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 坐标。
返回
在此 Region中包含指定点时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和点坐标。
适用于
IsVisible(Int32, Int32, Graphics)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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 坐标。
返回
在此 Region中包含指定点时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和点坐标。
适用于
IsVisible(Single, Single)
- Source:
- Region.cs
- Source:
- Region.cs
- 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
- Source:
- Region.cs
- Source:
- Region.cs
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
参数
返回
在此 Region中包含 point
时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
适用于
IsVisible(Rectangle, Graphics)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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
参数
返回
在此 Region中包含 rect
的任何部分时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和矩形坐标。
适用于
IsVisible(PointF, Graphics)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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
参数
返回
在此 Region中包含 point
时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和点坐标。
适用于
IsVisible(Point, Graphics)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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
参数
返回
在此 Region中包含 point
时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和点坐标。
适用于
IsVisible(RectangleF)
- Source:
- Region.cs
- Source:
- Region.cs
- 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 结构。
返回
在此 Region中包含 rect
的任何部分时,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
- Source:
- Region.cs
- Source:
- Region.cs
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
参数
返回
此方法在此 Region中包含 rect
的任何部分时返回 true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
适用于
IsVisible(PointF)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
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
参数
返回
在此 Region中包含 point
时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
适用于
IsVisible(RectangleF, Graphics)
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
- Source:
- Region.cs
使用指定的 Graphics绘制时,测试指定 RectangleF 结构的任何部分是否包含在此 Region 中。
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 结构。
返回
在此 Region中包含 rect
时,true
;否则,false
。
示例
有关代码示例,请参阅 IsVisible(RectangleF) 方法。
注解
图形上下文的当前转换用于计算绘图图面上的区域内部坐标和矩形坐标。