问题
Lets say that I've got the coordinates of two Rectangle
s, they could be right next to each other or have space between them. I need to draw a PolygonHotSpot
around the two rectangles (so it will only cover the two rectangles and the space between them). I've come to find that I have to give the coordinates a clockwise order around the entire polygon, rather than around each rectangle (which works fine for a single rectangle).
So given a list of coordinates, is there a way to get them into the order that I need for there to not be any gaps in my PolygonHotSpot
?
回答1:
You want the Union
of the two:
Dim R1 As New Rectangle(20, 20, 100, 100)
Dim R2 As New Rectangle(200, 200, 100, 100)
Dim R3 = Rectangle.Union(R1, R2) '//R3 = 20, 20, 280, 280
来源:https://stackoverflow.com/questions/4878124/draw-polygonhotspot-around-two-rectangles