private static void EndAngle_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { CircleSettingGraphic control = (CircleSettingGraphic)o; var v = control.GetPointByRotation(new Point(control.Radius, 0), (double)e.NewValue * Math.PI / 180, new Point()) - new Point(-control.Radius, -control.Radius); control.EndPoint = new Point(v.X, v.Y); control.UpdateCircle(); }
private static void Radius_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { CircleSettingGraphic control = (CircleSettingGraphic)o; var radius = (double)e.NewValue; if (control.Diameter != radius * 2) { control.Diameter = radius * 2; } var startV = control.GetPointByRotation(new Point(radius, 0), control.StartAngle * Math.PI / 180, new Point()) - new Point(-radius, -radius); var endV = control.GetPointByRotation(new Point(radius, 0), control.EndAngle * Math.PI / 180, new Point()) - new Point(-radius, -radius); control.StartPoint = new Point(startV.X, startV.Y); control.EndPoint = new Point(endV.X, endV.Y); control.UpdateCircle(); }