您好我想将我的图表拆分为四个部分。我如何定义其他3个界限。
Rect b = activeDiagram.Panel.DiagramBounds; // b = (-370, -190, 3099, 2450)
Rect bounds1 = new Rect((new System.Windows.Point(b.X,b.Y)), (new System.Windows.Point( (w/2) + b.X, (h/2) + b.Y ))); // bounds1 = (-370, -190, 1549.5, 1225)
答案 0 :(得分:2)
考虑到,您希望从diagramm边界获得4个相等的矩形,并且示例中的w
和h
是宽度和高度,您可以使用以下代码:
Rect bounds1 = new Rect(b.X, b.Y, w/2, h/2); //top left corner
Rect bounds2 = new Rect(b.X, b.Y + h/2, w/2, h/2); //bottom left corner
Rect bounds3 = new Rect(b.X + w/2, b.Y, w/2, h/2); //top right corner
Rect bounds4 = new Rect(b.X + w/2, b.Y h/2, w/2, h/2); //bottom right corner