private void UpdateSubCircle(float convToAngle, SubCircle c) { c.AnglePosition += tmr.Interval * convToAngle; if (c.AnglePosition > 2 * Math.PI) { c.AnglePosition -= (float)(2 * Math.PI); } foreach (Handle h in c.BigHandles) { h.AnglePosition -= tmr.Interval * convToAngle; if (h.AnglePosition > 2 * Math.PI) { h.AnglePosition -= (float)(2 * Math.PI); } } foreach (Handle h in c.SmallHandles) { h.AnglePosition += tmr.Interval * 2 * convToAngle; if (h.AnglePosition > 2 * Math.PI) { h.AnglePosition -= (float)(2 * Math.PI); } } }
private static void DrawSubCircle(Graphics g, SubCircle circle, RectangleF bounds, ClockTools tools) { RectangleF outer = bounds; float unit = (bounds.Width / 100f) / 2f; RectangleF inner = bounds; inner.Inflate(-10f * unit, -10f * unit); RectangleF center = bounds; center.Inflate(-90f * unit, -90f * unit); g.DrawEllipse(tools.LessthinBorder, outer); g.DrawEllipse(tools.ThinBorder, inner); g.FillEllipse(tools.Fill, center); RectangleF bigHandleBounds = bounds; bigHandleBounds.Inflate(-75 * unit, -75 * unit); RectangleF smallHandleBounds = bounds; smallHandleBounds.Inflate(-85 * unit, -85 * unit); foreach (Handle h in circle.BigHandles) { RectangleF r = bigHandleBounds; r.Offset(-r.X - r.Width / 2f, -r.Y - r.Height / 2f); r.Offset(GetPointAtAngleFromCircle(bigHandleBounds, bounds, h.AnglePosition)); g.DrawLine(tools.ThinBorder, new PointF(center.X + center.Width / 2, center.Y + center.Height / 2), new PointF(r.X + r.Width / 2f, r.Y + r.Height / 2f)); DrawHandle(g, r, tools); } foreach (Handle h in circle.SmallHandles) { RectangleF r = smallHandleBounds; r.Offset(-r.X - r.Width / 2f, -r.Y - r.Height / 2f); RectangleF outercircle = bounds; outercircle.Inflate(50f * unit, 50f * unit); r.Offset(GetPointAtAngleFromCircle(smallHandleBounds, outercircle, h.AnglePosition)); g.DrawLine(tools.ThinBorder, new PointF(center.X + center.Width / 2, center.Y + center.Height / 2), new PointF(r.X + r.Width / 2f, r.Y + r.Height / 2f)); DrawHandle(g, r, tools); } }