GraphicsPath.IsOutlineVisible(const PointF, const Pen*, const Graphics*) method
Applies to: desktop apps only
The GraphicsPath::IsOutlineVisible method determines whether a specified point touches the outline of this path when the path is drawn by a specified Graphics object and a specified pen.
Syntax
BOOL IsOutlineVisible(
[in, ref] const PointF &point,
[in] const Pen *pen,
[in] const Graphics *g
);
Parameters
point [in, ref]
Type: const PointFReference to the point to be tested.
pen [in]
Type: const Pen*Pointer to a Pen object. This method determines whether the test point touches the path outline that would be drawn by this pen. More points will touch an outline drawn by a wide pen than will touch an outline drawn by a narrow pen.
g [in]
Type: const Graphics*Optional. Pointer to a Graphics object that specifies a world-to-device transformation. If the value of this parameter is NULL, the test is done in world coordinates; otherwise, the test is done in device coordinates. The default value is NULL.
Return value
Type:
Type: BOOL
If the test point touches the outline of this path, this method returns TRUE; otherwise, it returns FALSE.
Examples
The following example creates an elliptical path and draws that path with a wide yellow pen. Then the code tests each point in an array to see whether the point touches the outline (as it would be drawn by the wide yellow pen) of the path. Points that touch the outline are painted green, and points that don't touch the outline are painted red.
VOID Example_IsOutlineVisibleExample(HDC hdc)
{
Graphics graphics(hdc);
INT j;
Pen yellowPen(Color(255, 255, 255, 0), 20);
SolidBrush brush(Color(255, 255, 0, 0));
// Create and draw a path.
GraphicsPath path;
path.AddEllipse(50, 50, 200, 100);
graphics.DrawPath(&yellowPen, &path);
// Create an array of three points, and determine whether each
// point in the array touches the outline of the path.
// If a point touches the outline, paint it green.
// If a point does not touch the outline, paint it red.
PointF[] = {
PointF(230, 138),
PointF(100, 120),
PointF(150, 170)};
for(j = 0; j <= 2; ++j)
{
if(path.IsOutlineVisible(points[j], &yellowPen, NULL))
brush.SetColor(Color(255, 0, 255, 0));
else
brush.SetColor(Color(255, 255, 0, 0));
graphics.FillEllipse(&brush, points[j].X - 3.0f, points[j].Y - 3.0f, 6.0f, 6.0f);
}
}
Color(255, 255, 0, 0)Color(255, 255, 0, 0)
Requirements
Minimum supported client |
Windows XP, Windows 2000 Professional |
Minimum supported server |
Windows 2000 Server |
Product |
GDI+ 1.0 |
Header |
Gdipluspath.h (include Gdiplus.h) |
Library |
Gdiplus.lib |
DLL |
Gdiplus.dll |
See also
Constructing and Drawing Paths
Setting Pen Width and Alignment
Send comments about this topic to Microsoft
Build date: 3/6/2012