0

こんにちは私は私の図を4つの部分に分割したいと思います。他の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)
4

1 に答える 1

2

ダイアグラムの境界から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
于 2012-09-06T13:24:44.560 に答える