开发者

C# Fill out a Rectangle with points

开发者 https://www.devze.com 2023-02-11 22:06 出处:网络
Hi I want to Fill out a Rectangle. Normally i can use: g.FillRectangle(Brushes.Green, x1, y1, x2, y2); But I do开发者_开发问答n\'t want to fill it completly out with a green color, I want to fill i

Hi I want to Fill out a Rectangle. Normally i can use:

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

But I do开发者_开发问答n't want to fill it completly out with a green color, I want to fill it out with points So i want it: One point black, one point green, one point black... Can you help me thanks


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消