GraphicsPath ::IsVisible(constPointF&,constGraphics*) , méthode (gdipluspath.h)

La méthode GraphicsPath ::IsVisible détermine si un point spécifié se trouve dans la zone qui est remplie lorsque ce chemin d’accès est rempli par un objet Graphics spécifié.

Syntaxe

BOOL IsVisible(
  const PointF & point,
  const Graphics *g
);

Paramètres

point

Référence au point à tester.

g

facultatif. Pointeur vers un objet Graphics qui spécifie une transformation monde-appareil. Si la valeur de ce paramètre est NULL, le test est effectué en coordonnées mondiales ; sinon, le test est effectué dans les coordonnées de l’appareil. La valeur par défaut est NULL.

Valeur retournée

Si le point de test se trouve à l’intérieur de ce chemin, cette méthode retourne TRUE ; sinon, il retourne FALSE.

Notes

Exemples

L’exemple suivant crée un chemin elliptique et dessine ce chemin avec un stylet noir étroit. Ensuite, le code teste chaque point d’un tableau pour voir si le point se trouve à l’intérieur du chemin. Les points qui se trouvent à l’intérieur sont peints en vert, et les points qui ne se trouvent pas à l’intérieur sont peints en rouge.

VOID IsVisibleExample(HDC hdc)
{
   Graphics graphics(hdc);

   INT j;
   Pen blackPen(Color(255, 0, 0, 0), 1);
   SolidBrush brush(Color(255, 255, 0,  0));

   // Create and draw a path.
   GraphicsPath path;
   path.AddEllipse(50, 50, 200, 100);
   graphics.DrawPath(&blackPen, &path);

   // Create an array of four 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(50, 100),
      PointF(250, 100),
      PointF(150, 170),
      PointF(180, 60)};

   for(j = 0; j <= 3; ++j)
   {
      if(path.IsVisible(points[j], &graphics))
         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);
   }
}

Configuration requise

   
En-tête gdipluspath.h

Voir aussi

Découpage avec une région

Génération et dessin de tracés

Création d’un dégradé de chemin

Graphismes

Graphicspath

Méthodes IsOutlineVisible

Méthodes IsVisible

Chemins d’accès

Pointf