protected override Size ArrangeOverride(Size arrangeBounds) { Point currentPosition = new Point(OuterRadius, InnerRadius); int countChild = Children.Count - 1, i, j = 2, count = 0; double angle = 2 * Math.PI / 7, k = 0; double offsetOfx = 0.0, offsetOfy = 0.0; for (i = 0; i <= countChild; i++) { if (i == 0) { UIElement child = Children[i]; Rect childRec = new Rect(117, 117, 48, 20); child.Arrange(childRec); } else { for (j = i; j <= countChild; j++) { count++; if (count <= 7) { UIElement child = Children[j]; double currentAngle = j * angle; offsetOfx = Math.Sin(currentAngle) * (OuterRadius + InnerRadius) / 2; offsetOfy = (1 - Math.Cos(currentAngle)) * (OuterRadius + InnerRadius) / 2; Rect childRec = new Rect( new Point(currentPosition.X - child.DesiredSize.Width / 2, currentPosition.Y - child.DesiredSize.Height / 2), new Point(currentPosition.X + child.DesiredSize.Width / 2, currentPosition.Y + child.DesiredSize.Height / 2)); child.Arrange(childRec); } else { break; } currentPosition.X = offsetOfx + OuterRadius; currentPosition.Y = offsetOfy + (OuterRadius - InnerRadius) / 2; } } if (i == 0) i = 0; else i = j - 1; count = 0; currentPosition.X = offsetOfx + OuterRadius; currentPosition.Y = offsetOfy + (OuterRadius - InnerRadius) / 2; } return new Size(2 * OuterRadius, 2 * OuterRadius); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)