GraphicsPath::IsOutlineVisible Method (Int32, Int32, Pen^, Graphics^)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- x
-
Type:
System::Int32
The x-coordinate of the point to test.
- y
-
Type:
System::Int32
The y-coordinate of the point to test.
- pen
-
Type:
System.Drawing::Pen^
The Pen to test.
- graphics
-
Type:
System.Drawing::Graphics^
The Graphics for which to test visibility.
Return Value
Type: System::BooleanThis method returns true if the specified point is contained within the outline of this GraphicsPath as drawn with the specified Pen; otherwise, false.
This method tests to see if the outline of a given path is rendered visible at the specified point. 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. The code performs the following actions:
Creates a path.
Adds a rectangle to the path.
Creates a wide pen and widens the path with that pen (to make the example clearer),
Tests a point (100, 50) to see if it lies within (under) one of the edges of the rectangle by calling IsOutlineVisible.
The result is shown in the message box (in this case, true). In other words the edge is rendered over that point.
public: void IsOutlineVisibleExample( PaintEventArgs^ e ) { GraphicsPath^ myPath = gcnew GraphicsPath; Rectangle rect = Rectangle(20,20,100,100); myPath->AddRectangle( rect ); Pen^ testPen = gcnew Pen( Color::Black,20.0f ); myPath->Widen( testPen ); e->Graphics->FillPath( Brushes::Black, myPath ); bool visible = myPath->IsOutlineVisible( 100, 50, testPen, e->Graphics ); MessageBox::Show( String::Format( "visible = {0}", visible ) ); }
Available since 1.1