Exemplo n.º 1
0
        protected override void EnableProperties()
        {
            Color.IsVisibleWhen(ColorMode, p => p.CurrentValue == SolidBrushColorMode.Static);
            Colors.IsHiddenWhen(ColorMode, p => p.CurrentValue == SolidBrushColorMode.Static);

            GradientPosition.IsVisibleWhen(ColorMode, p => p.CurrentValue == SolidBrushColorMode.GradientPosition);
            AnimationSpeed.IsVisibleWhen(ColorMode, p => p.CurrentValue == SolidBrushColorMode.GradientAnimation);
        }
Exemplo n.º 2
0
        protected virtual void OnGradientPositionChanged(GradientPosition Value)
        {
            var Point = default(Point);

            switch (GradientType)
            {
            case GradientType.Linear:
                switch (Value)
                {
                case GradientPosition.End:
                    Point = Gradient.As <LinearGradientBrush>().EndPoint;
                    break;

                case GradientPosition.Start:
                    Point = Gradient.As <LinearGradientBrush>().StartPoint;
                    break;
                }
                break;

            case GradientType.Radial:
                switch (Value)
                {
                case GradientPosition.End:
                    Point = Gradient.As <RadialGradientBrush>().Center;
                    break;

                case GradientPosition.Start:
                    Point = Gradient.As <RadialGradientBrush>().GradientOrigin;
                    break;
                }
                break;
            }

            AngleChangeHandled = true;
            var x = Math.Acos(Point.X);

            Angle = x / Math.PI / (1d / 180d);
            AngleChangeHandled = false;

            OnGradientChanged(new EventArgs <Brush>(Gradient));
        }