I have a shape that is defined by an outer border and then an inner border. IF there is no inner boarder, the shape is solid. If there is an inner border I want the polygon/path to be defined only between the two borders; I don’t want to draw the outside and then draw the inside in the background color.
For example, if I have a square defined by the following coordinates for the outside border:
{0,0}, {20, 0}, {20,20}, {0, 20}
Then that square which is 20×20 with its bottom left right corner on the origin. That shape then has a triangle cut out of the center:
{10,10}, {15,10}, {15,15}
How can I create a path that contains this shape using either WPF or GDI+?
In GDI+, you can use
FillPath()orDrawPath()withFillModeAlternate.There’s an example pretty close to what you’re asking for here.