Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        private static void Diameter_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            CircleSettingGraphic control = (CircleSettingGraphic)o;

            if (control.Radius != (double)e.NewValue / 2)
            {
                control.Radius = (double)e.NewValue / 2;
            }
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        private static object CaliperCount_CoerceValue(DependencyObject o, object baseValue)
        {
            CircleSettingGraphic control = (CircleSettingGraphic)o;

            if (baseValue is int count)
            {
                if (count < 4)
                {
                    return(4);
                }
                else if (count > 200)
                {
                    return(200);
                }
                else
                {
                    return(count);
                }
            }
            else
            {
                return(4);
            }
        }
Esempio n. 5
0
        private static void CaliperCount_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            CircleSettingGraphic control = (CircleSettingGraphic)o;

            control.RaisePropertyChanged(nameof(IntervalAngle));
        }