Export (0) Print
Expand All

GraphicsPath.IsVisible Method (Int32, Int32, Graphics)

Indicates whether the specified point is contained within this GraphicsPath, using the specified Graphics.

Namespace: System.Drawing.Drawing2D
Assembly: System.Drawing (in system.drawing.dll)

public bool IsVisible (
	int x,
	int y,
	Graphics graphics
)
public boolean IsVisible (
	int x, 
	int y, 
	Graphics graphics
)
public function IsVisible (
	x : int, 
	y : int, 
	graphics : Graphics
) : boolean
Not applicable.

Parameters

x

The x-coordinate of the point to test.

y

The y-coordinate of the point to test.

graphics

The Graphics for which to test visibility.

Return Value

This method returns true if the specified point is contained within this GraphicsPath; otherwise, false.

The coordinates of the point to be tested are given in world coordinates. The transform matrix of graphics is temporarily applied before testing for visibility.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. The code performs the following actions:

  • Creates a path and adds an ellipse to the path.

  • Tests whether the specified point is contained within the path.

  • Displays the result in a dialog box.

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());
}

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).
    boolean visible = myPath.IsVisible(50, 50, e.get_Graphics());

    // Show the result.
    MessageBox.Show(System.Convert.ToString(visible));
} //IsVisibleExample

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft