指定した Pen オブジェクトで描画され、指定した Graphics オブジェクトを使用している場合に、指定した点が GraphicsPath オブジェクトのアウトラインの中に含まれているかどうかを示します。
Overloads Public Function IsOutlineVisible( _
ByVal x As Integer, _ ByVal y As Integer, _ ByVal pen As Pen, _ ByVal graphics As Graphics _) As Boolean
[C#]
public bool IsOutlineVisible(intx,inty,Penpen,Graphicsgraphics);
[C++]
public: bool IsOutlineVisible(intx,inty,Pen* pen,Graphics* graphics);
[JScript]
public function IsOutlineVisible(
x : int,y : int,pen : Pen,graphics : Graphics) : Boolean;
パラメータ
戻り値
このメソッドは、指定した Pen オブジェクトで描画したときに、指定した点がこの GraphicsPath オブジェクトのアウトラインの中に含まれる場合は true を返します。それ以外の場合は false を返します。
解説
このメソッドは、指定したパスのアウトラインが描画され、指定した点の位置で表示されているかどうかをテストします。テスト対象の点の座標は、ワールド座標で指定します。 graphics の変換行列は、参照可能範囲をテストする前に一時的に適用されます。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 OnPaint イベントのオブジェクトである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
- パスを作成します。
- パスに四角形を追加します。
- 幅広のペンを作成し、(例をわかりやすくするため) そのペンでパスの幅を拡大します。
- IsOutlineVisible を呼び出すことで、点 (100, 50) が四角形の端のどれかの中 (下) に含まれるかどうかをテストします。
[Visual Basic, C#] 結果は、メッセージ ボックスに表示されます (この場合は true)。つまり、その点の上に端が描画されています。
Public Sub IsOutlineVisibleExample(e As PaintEventArgs)
Dim myPath As New GraphicsPath()
Dim rect As New Rectangle(20, 20, 100, 100)
myPath.AddRectangle(rect)
Dim testPen As New Pen(Color.Black, 20)
myPath.Widen(testPen)
e.Graphics.FillPath(Brushes.Black, myPath)
Dim visible As Boolean = myPath.IsOutlineVisible(100, 50, _
testPen, e.Graphics)
MessageBox.Show(("visible = " + visible.ToString()))
End Sub
[C#]
public void IsOutlineVisibleExample(PaintEventArgs e)
{
GraphicsPath myPath = new GraphicsPath();
Rectangle rect = new Rectangle(20, 20, 100, 100);
myPath.AddRectangle(rect);
Pen testPen = new Pen(Color.Black, 20);
myPath.Widen(testPen);
e.Graphics.FillPath(Brushes.Black, myPath);
bool visible = myPath.IsOutlineVisible(100, 50, testPen,
e.Graphics);
MessageBox.Show("visible = " + 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.IsOutlineVisible オーバーロードの一覧