开发者

How to create a clip region from a path that includes the 'outline'?

I am creating a rounded rectangle GraphicsPath (see red outline image below), and then using this as a clip region both when dr开发者_如何学运维awing graphics, and as the Region of a Form.

Unfortunately, although the path looks good, it doesn't work well as a region (see solid black image below)

Is there a way that I can generate a clipping region from the path that includes all the 'outline' pixels of the path? Do I need to generate a bitmap and then process this to create a region?

The rounded rectangle path:

How to create a clip region from a path that includes the 'outline'?

When used as a clip region:

How to create a clip region from a path that includes the 'outline'?

The discrepancy (red pixels are in the path outline, but outside the region. blue pixels are in both):

How to create a clip region from a path that includes the 'outline'?


I ended up drawing the shape into a bitmap and then converting this into a region.

Here is an example of this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜