在两个矩形周围绘制PolygonHotSpot? [英] Draw PolygonHotSpot around two Rectangles?
问题描述
让我们说我有两个Rectangle
的坐标,它们可以彼此相邻或在它们之间留有间隔.我需要在两个矩形周围绘制一个PolygonHotSpot
(因此它将仅覆盖两个矩形及其之间的空间).我发现我必须在整个多边形周围而不是在每个矩形周围(对单个矩形都适用)按顺时针方向赋予坐标.
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).
因此给定了一个坐标列表,是否有一种方法可以使它们按顺序排列,以使我的PolygonHotSpot
中没有任何间隙?
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
?
推荐答案
您要两者中的Union
:
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
这篇关于在两个矩形周围绘制PolygonHotSpot?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!