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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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 Forms 使用,而且需要 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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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)

來源:
Region.cs
來源:
Region.cs
來源:
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) 方法。

備註

圖形內容的目前轉換是用來計算繪圖介面上的區域內部和矩形座標。

適用於