次の方法で共有


GraphicsPath.IsVisible メソッド (Int32, Int32, Graphics)

指定した Graphics オブジェクトを使用して、指定した点がこの GraphicsPath オブジェクト内に含まれているかどうかを示します。

Overloads Public Function IsVisible( _
   ByVal x As Integer, _   ByVal y As Integer, _   ByVal graphics As Graphics _) As Boolean
[C#]
public bool IsVisible(intx,inty,Graphicsgraphics);
[C++]
public: bool IsVisible(intx,inty,Graphics* graphics);
[JScript]
public function IsVisible(
   x : int,y : int,graphics : Graphics) : Boolean;

パラメータ

  • x
    テストする点の x 座標。
  • y
    テストする点の y 座標。
  • graphics
    表示可能範囲をテストする対象の Graphics オブジェクト。

戻り値

このメソッドは、指定した点が GraphicsPath オブジェクトの中に含まれる場合は true を返します。それ以外の場合は false を返します。

解説

テスト対象の点の座標は、ワールド座標で指定します。 graphics の変換行列は、参照可能範囲をテストする前に一時的に適用されます。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • パスを作成し、そのパスに楕円を追加します。
  • 指定した点がパス内に含まれているかどうかをテストします。
  • 結果をダイアログ ボックスに表示します。
 
Public Sub IsVisibleExample(e As PaintEventArgs)
Dim myPath As New GraphicsPath()
myPath.AddEllipse(0, 0, 100, 100)
Dim visible As Boolean = myPath.IsVisible(50, 50, e.Graphics)
MessageBox.Show(visible.ToString())
End Sub
        
[C#] 
private void IsVisibleExample(PaintEventArgs e)
{
// Create a path and add an ellipse.
GraphicsPath myPath = new GraphicsPath();
myPath.AddEllipse(0, 0, 100, 100);
// Test the visibility of point (50, 50).
bool visible = myPath.IsVisible(50, 50, e.Graphics);
// Show the result.
MessageBox.Show(visible.ToString());
}
        

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

GraphicsPath クラス | GraphicsPath メンバ | System.Drawing.Drawing2D 名前空間 | GraphicsPath.IsVisible オーバーロードの一覧