예제 #1
0
        private void ChangeColorForGradation()
        {
            GradientStopCollection col = new GradientStopCollection();

            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 120, B = 120
            }, 1));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 105, B = 105
            }, 0.95));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 90, B = 90
            }, 0.90));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 75, B = 75
            }, 0.85));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 60, B = 60
            }, 0.80));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 45, B = 45
            }, 0.75));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 30, B = 30
            }, 0.70));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 15, B = 15
            }, 0.65));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 255, G = 0, B = 0
            }, 0.60));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 245, G = 0, B = 0
            }, 0.55));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 235, G = 0, B = 0
            }, 0.50));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 225, G = 0, B = 0
            }, 0.45));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 215, G = 0, B = 0
            }, 0.40));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 205, G = 0, B = 0
            }, 0.35));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 195, G = 0, B = 0
            }, 0.30));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 185, G = 0, B = 0
            }, 0.25));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 175, G = 0, B = 0
            }, 0.20));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 165, G = 0, B = 0
            }, 0.15));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 155, G = 0, B = 0
            }, 0.10));
            col.Add(new GradientStop(new Color()
            {
                A = 100, R = 145, G = 0, B = 0
            }, 0.05));

            GradientStopCollection bigCol = new GradientStopCollection();

            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 178, G = 0, B = 0
            }, 0));
            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 251, G = 171, B = 171
            }, 1));
            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 226, G = 10, B = 10
            }, 0.233));
            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 220, G = 33, B = 33
            }, 0.44));
            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 216, G = 83, B = 83
            }, 0.61));
            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 209, G = 7, B = 7
            }, 0.117));
            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 218, G = 25, B = 25
            }, 0.363));
            bigCol.Add(new GradientStop(new Color()
            {
                A = 100, R = 240, G = 118, B = 118
            }, 0.76));
            switch (SoulData.CurrentGradation)
            {
            case 5:
                mainCircle.Fill = new RadialGradientBrush(col.Where(color => col.IndexOf(color) % 4 == 0).ToGradientStopCollection());
                break;

            case 10:
                mainCircle.Fill = new RadialGradientBrush(col.Where(color => col.IndexOf(color) % 2 == 0).ToGradientStopCollection());
                break;

            case 20:
                mainCircle.Fill = new RadialGradientBrush(col);
                break;

            default:
                mainCircle.Fill = new RadialGradientBrush(bigCol);
                break;
            }
        }