开发者

Draw PolygonHotSpot around two Rectangles?

开发者 https://www.devze.com 2023-02-08 17:47 出处:网络
Lets say that I\'ve got the coordinates of two Rectangles, 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

Lets say that I've got the coordinates of two Rectangles, 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 coordinate开发者_JS百科s 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?


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
0

精彩评论

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