在inkcanvas上绘制大方块

问题描述:

您好,

我想在墨迹上绘制大方块。我将画笔大小定义为20,将形式定义为矩形。但我不希望方块重叠。它们必须总是一个在另一个之上,或者一个在另一个之上。

如何做到这一点?

提前完成。

Hello,
I would like to paint big squares on an inkcanvas. I define the brush size to 20 and the form as a rectangle. But I do not want the squares overlap. They must always be one above the other or one beside the other.
How to do that ?
Thans in advance.

1)将所有现有正方形的坐标存储在列表中< RectangleF >

2)创建一个新的可能方块。

3)迭代所有现有的正方形寻找重叠( RectangleF.Intersects()可以帮助)]

4)一个重叠就足以渲染这个潜在的广场无法使用,请尝试下一个。
1) Store all your existing squares' co-ordinates in a List<RectangleF>
2) Create a new possible square.
3) Iterate over all existing squares looking for overlaps (RectangleF.Intersects() may help)]
4) One overlap is enough to render this potential square unusable, try the next one.