~wirc-dev/wchat/devel

« back to all changes in this revision

Viewing changes to Ircsil/Controls/ShadowBorderDecorator.cs

  • Committer: Alex Regueiro
  • Date: 2010-05-07 22:35:30 UTC
  • Revision ID: alexreg@gmail.com-20100507223530-0dmcni4hiyicauck
dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
{
10
10
    public class ShadowBorderDecorator : Decorator
11
11
    {
12
 
        private static SolidColorBrush backgroundBrush;
13
 
        private static LinearGradientBrush leftBrush;
14
 
        private static LinearGradientBrush topBrush;
15
 
        private static LinearGradientBrush rightBrush;
16
 
        private static LinearGradientBrush bottomBrush;
17
 
        private static RadialGradientBrush topLeftBrush;
18
 
        private static RadialGradientBrush topRightBrush;
19
 
        private static RadialGradientBrush bottomLeftBrush;
20
 
        private static RadialGradientBrush bottomRightBrush;
 
12
        private SolidColorBrush backgroundBrush;
 
13
        private LinearGradientBrush leftBrush;
 
14
        private LinearGradientBrush topBrush;
 
15
        private LinearGradientBrush rightBrush;
 
16
        private LinearGradientBrush bottomBrush;
 
17
        private RadialGradientBrush topLeftBrush;
 
18
        private RadialGradientBrush topRightBrush;
 
19
        private RadialGradientBrush bottomLeftBrush;
 
20
        private RadialGradientBrush bottomRightBrush;
21
21
 
22
22
        static ShadowBorderDecorator()
23
23
        {
24
24
            MarginProperty.OverrideMetadata(typeof(ShadowBorderDecorator), new FrameworkPropertyMetadata(new Thickness(6)));
 
25
        }
 
26
 
 
27
        public ShadowBorderDecorator()
 
28
            : base()
 
29
        {
 
30
            this.StartAlpha = 96;
 
31
            this.EndAlpha = 0;
25
32
 
26
33
            CreateBrushes();
27
34
        }
28
35
 
29
 
        private static void CreateBrushes()
 
36
        public byte StartAlpha
 
37
        {
 
38
            get;
 
39
            set;
 
40
        }
 
41
 
 
42
        public byte EndAlpha
 
43
        {
 
44
            get;
 
45
            set;
 
46
        }
 
47
 
 
48
        private void CreateBrushes()
30
49
        {
31
50
            // Create gradient stops for given shadow color.
32
 
            var shadowColor = Color.FromArgb(128, 0, 0, 0);
33
 
            var transparentColor = Color.FromArgb(0, 0, 0, 0);
 
51
            var shadowColor = Color.FromArgb(this.StartAlpha, 0, 0, 0);
 
52
            var transparentColor = Color.FromArgb(this.EndAlpha, 0, 0, 0);
34
53
            var gradientStops = new GradientStopCollection(2)
35
54
                {
36
55
                    new GradientStop(shadowColor, 0),