Pregunta

hola Quiero llenar un rectángulo.Normalmente puedo usar:

g.FillRectangle(Brushes.Green, x1, y1, x2, y2);

Pero no quiero llenarlo completamente con un color verde, quiero llenarlo con puntos Así que lo quiero: un punto negro, un punto verde, un punto negro ... Me puedes ayudar gracias

¿Fue útil?

Solución

You'll want to use a HatchBrush with HatchStyle.Percent50, instead of your normal green brush, like so:

Brush b = new HatchBrush(HatchStyle.Percent50, Color.Green, Color.Black);
g.FillRectangle(b, x1, y1, x2, y2);

For a demo of the other hatchstyles, see the following demo.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top