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:
When used as a clip region:
The discrepancy (red pixels are in the path outline, but outside the region. blue pixels are in both):
I ended up drawing the shape into a bitmap and then converting this into a region.
Here is an example of this.
精彩评论