2012-09-06 73 views
0

嗨,我想將我的圖分成四部分。我怎樣才能定義其他3個界限。在4部分中切割圖

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) 

回答

2

考慮,你想從diagramm界限,並在你的榜樣wh的寬度和高度,你可以用下面的代碼4米相等的長方形:

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

thanx的烏拉圭回合的幫助! – H79