Draw PolygonHotSpot around two Rectangles?

感情迁移 提交于 2019-12-24 07:18:07

问题


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 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!