Пример #1
1
        public Meter8()
        {
            var borderBrush = new LinearGradientBrush();
            borderBrush.StartPoint = new Point();
            borderBrush.EndPoint = new Point(1d, 1d);
            borderBrush.GradientStops.Add(new GradientStop() { Color = Colors.White, Offset = 0d });
            borderBrush.GradientStops.Add(new GradientStop() { Color = Colors.White, Offset = 0.4999d });
            borderBrush.GradientStops.Add(new GradientStop() { Color = Color.FromArgb(0xff, 0x84, 0x7B, 0x6C), Offset = 0.5d });
            borderBrush.GradientStops.Add(new GradientStop() { Color = Color.FromArgb(0xff, 0x84, 0x7B, 0x6C), Offset = 1d });
            var border = new Rectangle();
            border.Fill = borderBrush;
            //border.Stroke = new SolidColorBrush(Colors.Black);
            //border.StrokeThickness = 1d;

            var background = new Rectangle();
            background.Fill = new SolidColorBrush(Color.FromArgb(0xff, 0xAD, 0xA7, 0x9D));
            background.Margin = new Thickness(4d);

            var grid = new Grid();
            grid.Children.Add(border);
            grid.Children.Add(background);
            grid.Children.Add(_canvas);
            grid.Children.Add(_calibrationCanvas);

            this.Content = grid;

            _label.Text = Value.ToString();
            _label.Foreground = new SolidColorBrush(ForeColor);

            _pointLine.Stroke = new SolidColorBrush(Colors.Red);
            _pointLine.StrokeThickness = 2d;
            this.SizeChanged += Meter_SizeChanged;
        }
Пример #2
0
        /// <summary>
        /// Main windows에 적용 할 수 있는 간략한 Data 테스트
        /// </summary>
        private void SetCustomData()
        {
            // 제목
            Title = "Display Some Text";

            //// 현재 창에 나타날 data
            //Content = "Content can be simple text!";

            // font 지정
            FontFamily = new FontFamily("Comic Sans MS");

            FontSize = 48;

            // gradient 효과가 적용된 Brush
            Brush brush = new LinearGradientBrush(Colors.Black, Colors.White, new Point(0,0), new Point(1,1));

            Background = brush;
            Foreground = brush;

            // 현재 창의 content 내용에 따라 창의 크기를 조절 할 수 있는 값
            SizeToContent = SizeToContent.WidthAndHeight;

            // 현재 창의 Resizing 방법 지정
            ResizeMode = ResizeMode.CanMinimize;
        }
Пример #3
0
        private void SetDefaultButtonOption()
        {
            Title = "Command the button";

            Button btn = new Button();
            btn.HorizontalAlignment = HorizontalAlignment.Center;
            btn.VerticalAlignment = VerticalAlignment.Center;

            // ApplicationCommands = application에 기본 제공되는 Input 방식
            // 복사, 붙여 넣기, 삭제, 프린트 등 몇 가지 기능이 제공된다.
            btn.Command = ApplicationCommands.Paste;

            btn.Content = ApplicationCommands.Paste.Text;

            // gradient 효과가 적용된 Brush
            Brush brush = new LinearGradientBrush(Colors.Black, Colors.White, new Point(0, 0), new Point(1, 1));

            btn.Background = brush;

            // windows form의 this.controls.Add(btn)과 유사한 기능이라고 보면 되려나?
            Content = btn;

            // **
            // 이번 실습의 주요 기능!
            // 실제 button에 대한 제어 부분은 상태를 보여주기 위하여 도구일 뿐이며,
            // 하단의 코드를 통하여 Window에 Text에 대한 "붙여 넣기" 이벤트가 발생 시에 특정 동작을 실행 할 수 있음을 보여주는 기능이다.
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, PasteOnExecute, PasteCanExecute));
        }
Пример #4
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.BackgroudGrad = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 2:
                this.FullKeyBox = ((System.Windows.Controls.TextBox)(target));

            #line 19 "..\..\..\windows\KeyWindow.xaml"
                this.FullKeyBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.FullKeyBox_TextChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.KeyAgreeButton = ((System.Windows.Controls.Button)(target));

            #line 22 "..\..\..\windows\KeyWindow.xaml"
                this.KeyAgreeButton.Click += new System.Windows.RoutedEventHandler(this.KeyAgreeButton_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.KeyErrors = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #5
0
        public Meter5()
        {
            var borderBrush = new LinearGradientBrush();
            borderBrush.StartPoint = new Point();
            borderBrush.EndPoint = new Point(1d, 1d);
            borderBrush.GradientStops.Add(new GradientStop() { Color = Colors.White, Offset = 0d });
            borderBrush.GradientStops.Add(new GradientStop() { Color = Colors.White, Offset = 0.4999d });
            borderBrush.GradientStops.Add(new GradientStop() { Color = Color.FromArgb(0xff, 0x80, 0x80, 0x80), Offset = 0.5d });
            borderBrush.GradientStops.Add(new GradientStop() { Color = Color.FromArgb(0xff, 0x80, 0x80, 0x80), Offset = 1d });
            var border = new Rectangle();
            border.Fill = borderBrush;
            border.Stroke = new SolidColorBrush(Colors.Black);
            border.StrokeThickness = 1d;

            var background = new Rectangle();
            background.Fill = new SolidColorBrush(Color.FromArgb(0xff, 0xc0, 0xc0, 0xc0));
            background.Margin = new Thickness(4d);

            var grid = new Grid();
            grid.Children.Add(border);
            grid.Children.Add(background);
            grid.Children.Add(_canvas);
            grid.Children.Add(_calibrationCanvas);

            this.Content = grid;

            _pointPath.Fill = new SolidColorBrush(Colors.Red);
            _pointPath.Stroke = new SolidColorBrush(Colors.Black);
            _pointPath.StrokeThickness = 1d;
            this.SizeChanged += Meter_SizeChanged;
        }
Пример #6
0
        public static Brush ModifyFillBrushIfSelected(IFigure figure, Brush brush, FigureStyle style)
        {
            // Below is my suggestion for the fill appearance when a shape is selected. - David
            var brushAsSolidColor = brush as SolidColorBrush;
            if (figure != null && figure.Selected && !(style is PointStyle) && brushAsSolidColor != null)
            {
                // brush.Opacity = 0.2; // The previous method of showing a figure is selected.

                // The color of the stripes in the gradient is made by shifting the Fill color toward a gray value.
                var b = new LinearGradientBrush();
                var shapeWidth = 200;   // Arbitrary value.  Using the with of the figure would be better.
                b.StartPoint = new Point(0.0, 0.0);
                b.EndPoint = new Point(1.0, 0.0);
                double gap = 6;    // Actually half the gap between stripes in physical coordinates.
                double s = gap / shapeWidth;
                byte gray = 200;    // The gray value to shift the Fill color toward.
                double similarity = .65;    // How similar are the Fill color and the gray value (1 = similar, 0 = not).
                byte alpha = ((int)brushAsSolidColor.Color.A < 128) ? (byte)128 : brushAsSolidColor.Color.A;  // We need some opacity.
                for (double i = 0; i + s + s < 1; i += 2 * s)
                {
                    b.GradientStops.Add(new GradientStop() { Color = brushAsSolidColor.Color, Offset = i + .7 * s });
                    b.GradientStops.Add(new GradientStop()
                    {
                        Color = Color.FromArgb(alpha, (byte)(gray + (brushAsSolidColor.Color.R - gray) * similarity),
                                                      (byte)(gray + (brushAsSolidColor.Color.G - gray) * similarity),
                                                      (byte)(gray + (brushAsSolidColor.Color.B - gray) * similarity)),
                        Offset = i + s
                    });
                    b.GradientStops.Add(new GradientStop() { Color = brushAsSolidColor.Color, Offset = i + s + .3 * s });
                }
                brush = b;
            }
            // End of suggestion.
            return brush;
        }
Пример #7
0
		static ResizeChrome()
		{
			TransparentBrush = Brushes.Transparent;
			TransparentBrush.Freeze();
			var borderBrush = new LinearGradientBrush()
			{
				Opacity = 0.7,
				StartPoint = new Point(0, 0),
				EndPoint = new Point(1, 0.3),

			};
			borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 0));
			borderBrush.GradientStops.Add(new GradientStop(Colors.LightBlue, 0.5));
			borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 1));
			borderBrush.Freeze();
			BorderBrush = borderBrush;
			var thumbBrush = new RadialGradientBrush()
			{
				Center = new Point(0.3, 0.3),
				GradientOrigin = new Point(0.3, 0.3),
				RadiusX = 0.7,
				RadiusY = 0.7,
			};
			thumbBrush.GradientStops.Add(new GradientStop(Colors.White, 0));
			thumbBrush.GradientStops.Add(new GradientStop(Colors.DarkSlateBlue, 0.9));
			thumbBrush.Freeze();
			ThumbBrush = thumbBrush;
			TransparentPen = new Pen(TransparentBrush, 3.5);
			BorderPen = new Pen(BorderBrush, 2);
			BorderPen.DashStyle = DashStyles.Dash;
			ThumbGeometry = new EllipseGeometry();
			UpdateZoom(1);
		}
Пример #8
0
 public LinearGradientAnimation(LinearGradientBrush fromValue, LinearGradientBrush toValue, Duration duration)
     : this()
 {
     this.From = fromValue;
     this.To = toValue;
     base.Duration = duration;
 }
Пример #9
0
        public BGBarListBoxItem(RecFolderInfo item)
        {
            InitializeComponent();

            labelFolder.Content = item.recFolder;
            progressBar.Value = item.freeBytes;
            progressBar.Maximum = item.totalBytes;

            GradientStopCollection stops = new GradientStopCollection();
            stops.Add(new GradientStop(Colors.Red, 0.1));
            stops.Add(new GradientStop(Colors.Yellow, 0.3));
            stops.Add(new GradientStop(Colors.Lime, 0.4));
            LinearGradientBrush brush = new LinearGradientBrush(stops, new Point(0, 0), new Point(1, 0));
            brush.ColorInterpolationMode = ColorInterpolationMode.SRgbLinearInterpolation;
            progressBar.Background = brush;

            if (item.freeBytes > 0 && item.totalBytes > 0)
            {
                List<string> units = new List<string> { "Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
                int unit_base = 1024;

                int n = (int)Math.Floor(Math.Min(Math.Log(item.freeBytes) / Math.Log(unit_base), units.Count - 1));
                int m = (int)Math.Floor(Math.Min(Math.Log(item.totalBytes) / Math.Log(unit_base), units.Count - 1));
                ToolTip = "空き容量: " + Math.Round(item.freeBytes / Math.Pow(unit_base, n), 1).ToString() + " " + units[n]
                 + "/" + Math.Round(item.totalBytes / Math.Pow(unit_base, m), 1).ToString() + " " + units[m];
            }
        }
Пример #10
0
        private void drawPoint(Point p, Canvas testCanvas)
        {
            //create shape
            System.Diagnostics.Debug.WriteLine("Creating shape");
            Shape userShape;

            Shape shape = new Ellipse();
            shape.SetValue(Canvas.LeftProperty, p.X);
            shape.SetValue(Canvas.TopProperty, p.Y);
            //shape.HorizontalAlignment = HorizontalAlignment.Left;
            //shape.VerticalAlignment = VerticalAlignment.Center;
            shape.Width = 4;
            shape.Height = 4;
            shape.Stroke = new SolidColorBrush(Colors.Black);
            shape.StrokeThickness = 3.0;

            GradientBrush gb = new LinearGradientBrush();
            gb.GradientStops = new GradientStopCollection();
            GradientStop g1 = new GradientStop();
            g1.Color = Colors.Red;
            gb.GradientStops.Add(g1);
            g1 = new GradientStop();
            g1.Color = Colors.Blue;
            g1.Offset = 2;
            gb.GradientStops.Add(g1);

            shape.Fill = gb;

            shape.Visibility = System.Windows.Visibility.Visible;
            shape.Opacity = 0.5;

            testCanvas.Children.Add(shape);
        }
Пример #11
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 10 "..\..\..\Controls\KinectHoverButton.xaml"
                ((LightBuzz.Vitruvius.Controls.KinectHoverButton)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.Mask = ((System.Windows.Media.SolidColorBrush)(target));
                return;

            case 3:
                this.Effect = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 4:
                this.Icon = ((System.Windows.Controls.Image)(target));
                return;

            case 5:
                this.Text = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #12
0
        public static System.Windows.Media.Brush ToBrush(this StyleColor sc)
        {
            if (sc.FillType == ColorFillType.Solid)
            {
                return(new System.Windows.Media.SolidColorBrush(StyleColorExtension.FromArgb(sc.ARGB)));
            }
            else if (sc.FillType == ColorFillType.Gradient)
            {
                var lineb     = new System.Windows.Media.LinearGradientBrush();
                var newFrames = sc.Frames;
                if (newFrames == null || newFrames.Count == 0)
                {
                    newFrames    = new Dictionary <double, int>();
                    newFrames[0] = -1;
                    newFrames[1] = -16777216;
                }
                foreach (var keypair in newFrames)
                {
                    var gradientStop = new System.Windows.Media.GradientStop(
                        StyleColorExtension.FromArgb(keypair.Value),
                        keypair.Key);
                    lineb.GradientStops.Add(gradientStop);
                }

                var aRotateTransform = new System.Windows.Media.RotateTransform();
                aRotateTransform.CenterX = 0.5;
                aRotateTransform.CenterY = 0.5;
                aRotateTransform.Angle   = sc.Angle;
                lineb.RelativeTransform  = aRotateTransform;
                return(lineb);
            }

            return(null);
        }
        public void setgradient(Panel elm)
        {
            LinearGradientBrush myBrush = new LinearGradientBrush();

            Point startpoint = new Point();
            int angle = CommunConfig.getInstance().Angle;
            startpoint.X = System.Math.Cos(((double)angle / 180) * System.Math.PI)/2 + 0.5;
            startpoint.Y = System.Math.Sin(((double)angle / 180) * System.Math.PI)/2 + 0.5;

            angle -= 180;
            Point endpoint = new Point();
            endpoint.X = System.Math.Cos(((double)angle / 180) * System.Math.PI)/2 +0.5;
            endpoint.Y = System.Math.Sin(((double)angle / 180) * System.Math.PI)/2 +0.5;

            myBrush.StartPoint = startpoint;
            myBrush.EndPoint = endpoint;
            System.Windows.Media.Color c = new Color();
            System.Drawing.Color  drawingColor  = CommunConfig.getInstance().StartColor;
            c = System.Windows.Media.Color.FromRgb(drawingColor.R, drawingColor.G, drawingColor.B);
            myBrush.GradientStops.Add(new GradientStop(c, 1));

            drawingColor = CommunConfig.getInstance().EndColor;
            c = System.Windows.Media.Color.FromRgb(drawingColor.R, drawingColor.G, drawingColor.B);

            myBrush.GradientStops.Add(new GradientStop(c, 0));
            elm.Background = myBrush;
        }
        public ZoomingAndPanning()
        {
            InitializeComponent();

            var gradientBrush = new LinearGradientBrush {StartPoint = new Point(0, 0),
                EndPoint = new Point(0, 1)};
            gradientBrush.GradientStops.Add(new GradientStop(Color.FromRgb(33, 148, 241), 0));
            gradientBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1));

            SeriesCollection = new SeriesCollection
            {
                new LineSeries
                {
                    Values = GetData(),
                    Fill = gradientBrush,
                    StrokeThickness = 1,
                    PointGeometrySize = 0
                }
            };

            ZoomingMode = ZoomingOptions.X;

            XFormatter = val => new DateTime((long) val).ToString("dd MMM");
            YFormatter = val => val.ToString("C");

            DataContext = this;
        }
Пример #15
0
        public static Sm.LinearGradientBrush ToMediaBrush(this Wg.GradientLinear input)
        {
            Sm.LinearGradientBrush brush = new Sm.LinearGradientBrush();
            int i = 0;

            foreach (Wg.Color color in input.Colors)
            {
                brush.GradientStops.Add(new Sm.GradientStop(color.ToMediaColor(), input.Stops[i]));
                i++;
            }

            brush.SpreadMethod = Sm.GradientSpreadMethod.Pad;
            brush.MappingMode  = Sm.BrushMappingMode.RelativeToBoundingBox;

            double radians = input.Angle / 180 * Math.PI;
            double XA      = (0.5 + Math.Sin(radians) * 0.5);
            double YA      = (0.5 + Math.Cos(radians) * 0.5);
            double XB      = (0.5 + Math.Sin(radians + Math.PI) * 0.5);
            double YB      = (0.5 + Math.Cos(radians + Math.PI) * 0.5);

            brush.StartPoint = new Point(XA, YA);
            brush.EndPoint   = new Point(XB, YB);

            return(brush);
        }
Пример #16
0
        public GradiateTheBrush()
        {
            Title = "Gradiate the Brush";

            LinearGradientBrush brush = new LinearGradientBrush(Colors.Red, Colors.Blue, new Point(0,0), new Point(1,1));
            Background = brush;
        }
 public LinearCanvasGradient(double x0, double y0, double x1, double y1)
 {
     _brush = new LinearGradientBrush();
     _brush.StartPoint = new Point(x0, y0);
     _brush.EndPoint = new Point(x1, y1);
     _brush.MappingMode = BrushMappingMode.Absolute;
 }
        private void PaintBackground()
        {
            var backgroundSquare = new GeometryDrawing(Brushes.Black, null, new RectangleGeometry(new Rect(0, 0, 100, 100)));

            var aGeometryGroup = new GeometryGroup();
            aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(0, 0, 50, 50)));
            aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(50, 50, 50, 50)));

            var checkerBrush = new LinearGradientBrush();
            checkerBrush.GradientStops.Add(new GradientStop(Colors.Black, 0.0));
            checkerBrush.GradientStops.Add(new GradientStop(Color.FromRgb(0, 22, 0), 1.0));

            var checkers = new GeometryDrawing(checkerBrush, null, aGeometryGroup);

            var checkersDrawingGroup = new DrawingGroup();
            checkersDrawingGroup.Children.Add(backgroundSquare);
            checkersDrawingGroup.Children.Add(checkers);

            var myBrush = new DrawingBrush
            {
                Drawing = checkersDrawingGroup,
                Viewport = new Rect(0, 0, 0.02, 0.02),
                TileMode = TileMode.Tile,
                Opacity = 0.5
            };

            LayoutRoot.Background = myBrush;
        }
        private static void Process(IList<ComposerEraViewModel> composerEraViewModels)
        {
            var count = composerEraViewModels.Count;

            for (int i = 0; i < count - 1; i++)
            {
                var era1StartDate = composerEraViewModels[i].Dates.Earliest();
                var era1EndDate = composerEraViewModels[i].Dates.Latest();

                var era2StartDate = composerEraViewModels[i + 1].Dates.Earliest();
                var era2EndDate = composerEraViewModels[i + 1].Dates.Latest();

                if (era2StartDate < era1EndDate)
                {
                    var transitionBrush = new LinearGradientBrush();
                    transitionBrush.StartPoint = new Point(0, 0.5);
                    transitionBrush.EndPoint = new Point(1, 0.5);
                    transitionBrush.GradientStops.Add(new GradientStop(((SolidColorBrush)composerEraViewModels[i].Background).Color, 0));
                    transitionBrush.GradientStops.Add(new GradientStop(((SolidColorBrush)composerEraViewModels[i + 1].Background).Color, 1));

                    var transitionEra = new ComposerEraViewModel(null, new ExtendedDateTimeInterval(era2StartDate, era1EndDate), transitionBrush, Brushes.White);

                    composerEraViewModels[i].Dates = new ExtendedDateTimeInterval(era1StartDate, era2StartDate);
                    composerEraViewModels[i + 1].Dates = new ExtendedDateTimeInterval(era1EndDate, era2EndDate);

                    composerEraViewModels.Add(transitionEra);
                }
            }
        }
        public ZomingAndPanningExample()
        {
            InitializeComponent();

            var gradientBrush = new LinearGradientBrush
            {
                StartPoint = new System.Windows.Point(0, 0),
                EndPoint = new Point(0, 1)
            };
            gradientBrush.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromRgb(33, 148, 241), 0));
            gradientBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1));

            cartesianChart1.Series.Add(new LineSeries
            {
                Values = GetData(),
                Fill = gradientBrush,
                StrokeThickness = 1,
                PointGeometry = null
            });

            cartesianChart1.Zoom = ZoomingOptions.X;

            cartesianChart1.AxisX.Add(new Axis
            {
                LabelFormatter = val => new System.DateTime((long)val).ToString("dd MMM")
            });

            cartesianChart1.AxisY.Add(new Axis
            {
                LabelFormatter = val => val.ToString("C")
            });
        }
Пример #21
0
 public GradientTheBrush()
 {
     Title = "Gradient the Brush";
     LinearGradientBrush brush = new LinearGradientBrush(Colors.Red, Colors.Blue, new Point(0, 0), new Point(1, 1));
     Background = brush;
     brush.SpreadMethod = GradientSpreadMethod.Reflect;
 }
Пример #22
0
        public static Brush LinearGradientColorBrush(string status)
        {
            LinearGradientBrush tempBrush = new LinearGradientBrush();
            tempBrush.StartPoint = new Point(0, 0);
            tempBrush.EndPoint = new Point(10, 10);
            tempBrush.Opacity = .5;

            tempBrush.MappingMode = BrushMappingMode.Absolute;
            tempBrush.SpreadMethod = GradientSpreadMethod.Repeat;

            GradientStop stop1 = new GradientStop();
            stop1.Color = StatusStringToColorObject(status);
            tempBrush.GradientStops.Add(stop1);

            GradientStop stop2 = new GradientStop();
            stop2.Color = StatusStringToColorObject(status);
            stop2.Offset = 0.49;
            tempBrush.GradientStops.Add(stop2);

            GradientStop stop3 = new GradientStop();
            stop3.Color = Colors.Transparent;
            stop3.Offset = 0.51;
            tempBrush.GradientStops.Add(stop3);

            GradientStop stop4 = new GradientStop();
            stop3.Color = Colors.Transparent;
            stop3.Offset = 1;
            tempBrush.GradientStops.Add(stop4);

            return tempBrush;
        }
        private static void ProgressColorChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ProgressBarGame senderCast = sender as ProgressBarGame;
            if (senderCast == null)
            {
                return;		// this should never happen
            }

            Color color = (Color)e.NewValue;

            // Turn the color into a slight gradient
            LinearGradientBrush brush = new LinearGradientBrush();
            brush.StartPoint = new Point(0, 0);
            brush.EndPoint = new Point(0, 1);

            GradientStopCollection gradients = new GradientStopCollection();
            gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.White, color, .5d), 0d));
            gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.White, color, .25d), .1d));
            gradients.Add(new GradientStop(color, .4d));
            gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.Black, color, .2d), .9d));
            gradients.Add(new GradientStop(UtilityWPF.AlphaBlend(Colors.Black, color, .25d), 1d));
            brush.GradientStops = gradients;

            // The progress bar is actually tied to this property
            senderCast.ProgressBrush = brush;
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var isKeyboardFocusWithin = (bool)value;

            if (isKeyboardFocusWithin)
            {
                LinearGradientBrush linGrBrush = new LinearGradientBrush();

                linGrBrush.StartPoint = new Point(0.5, 0);
                linGrBrush.EndPoint = new Point(0.5, 1);

                GradientStop firstGrStop = new GradientStop();
                firstGrStop.Color = Color.FromArgb(255, 253, 211, 168);
                GradientStop secondGrStop = new GradientStop();
                secondGrStop.Color = Color.FromArgb(255, 252, 231, 159);

                linGrBrush.GradientStops.Add(firstGrStop);
                linGrBrush.GradientStops.Add(secondGrStop);

                return linGrBrush;
            }
            else
            {
                return new SolidColorBrush(Colors.LightGray);
            }
        }
        /// <summary>Creates a gradient brush with the given colors flowing in the specified direction.</summary>
        /// <param name="direction">The direction of the gradient.</param>
        /// <param name="start">The starting color.</param>
        /// <param name="end">The ending color.</param>
        public static LinearGradientBrush ToGradient(this Direction direction, Color start, Color end)
        {
            // Create the brush.
            var brush = new LinearGradientBrush();
            switch (direction)
            {
                case Direction.Down:
                case Direction.Up:
                    brush.StartPoint = new Point(0.5, 0);
                    brush.EndPoint = new Point(0.5, 1);
                    break;
                case Direction.Right:
                case Direction.Left:
                    brush.StartPoint = new Point(0, 0.5);
                    brush.EndPoint = new Point(1, 0.5);
                    break;
            }

            // Configure colors.
            var gradientStart = new GradientStop { Color = start };
            var gradientEnd = new GradientStop { Color = end };

            gradientStart.Offset = direction == Direction.Up || direction == Direction.Left ? 1 : 0;
            gradientEnd.Offset = direction == Direction.Down || direction == Direction.Right ? 1 : 0;

            // Insert colors.
            brush.GradientStops.Add(gradientStart);
            brush.GradientStops.Add(gradientEnd);

            // Finish up.
            return brush;
            
        }
Пример #26
0
		private static LinearGradientBrush CreateGradientBrush(Orientation orientation, params Color[] colors)
		{
		    var brush = new LinearGradientBrush();
			var negatedStops = 1 / (float) colors.Length;

			for (var i = 0; i < colors.Length; i++)
			{
				brush.GradientStops.Add(new GradientStop { Offset = negatedStops * i, Color = colors[i] });
			}

			// creating the full loop
			brush.GradientStops.Add(new GradientStop { Offset = negatedStops * colors.Length, Color = colors[0] });

            if (orientation == Orientation.Vertical)
            {
                brush.StartPoint = new Point(0, 1);
                brush.EndPoint = new Point();
            }
            else
            {
                brush.EndPoint = new Point(1, 0);
            }

            return brush;
        }
Пример #27
0
        public static LinearGradientBrush GetLineBrush()
        {
            //<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            //<GradientStop Color="#FFCCCCCC" Offset="0"/>
            //<GradientStop Color="Black" Offset="1"/>
            //<GradientStop Color="#FFABABAB" Offset="0.457"/>
            //<GradientStop Color="Black" Offset="0.53"/>
            //</LinearGradientBrush>
            LinearGradientBrush brush = new LinearGradientBrush();
            brush.EndPoint = new Point(0.5, 1);
            brush.StartPoint = new Point(0.5, 0);

            GradientStop gs = new GradientStop();
            gs.Color = ConvertColor("#FFCCCCCC");
            gs.Offset = 0;
            brush.GradientStops.Add(gs);

            gs = new GradientStop();
            gs.Color = Colors.Black;
            gs.Offset = 1;
            brush.GradientStops.Add(gs);

            gs = new GradientStop();
            gs.Color = ConvertColor("#FFABABAB");
            gs.Offset = 0.457;
            brush.GradientStops.Add(gs);

            gs = new GradientStop();
            gs.Color = Colors.Black;
            gs.Offset = 0.53;
            brush.GradientStops.Add(gs);

            return brush;
        }
        /// <summary>
        /// Create a ScrollViewer that can be used by the tests.
        /// </summary>
        /// <returns>A ScrollViewer that can be used by the tests.</returns>
        private static ScrollViewer CreateTestScrollViewer()
        {
            LinearGradientBrush brush = new LinearGradientBrush
            {
                StartPoint = new Point(),
                EndPoint = new Point(1, 1)
            };
            brush.GradientStops.Add(new GradientStop { Offset = 0, Color = Colors.Red });
            brush.GradientStops.Add(new GradientStop { Offset = 1, Color = Colors.Blue });

            Canvas panel = new Canvas
            {
                Height = 400,
                Width = 400,
                Background = brush
            };

            return new ScrollViewer
            {
                Height = 100,
                Width = 100,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                Content = panel
            };
        }
Пример #29
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var color = (string) value;

            try
            {
                TypeConverter colorConverter = new ColorConverter();
                var baseColor = (Color) colorConverter.ConvertFromString(color);

                var c2 = Color.FromArgb(25, baseColor.R, baseColor.G, baseColor.B);

                var colorBrush = new LinearGradientBrush();
                colorBrush.StartPoint = new Point(0, 0);
                colorBrush.EndPoint = new Point(0, 1);
                colorBrush.GradientStops.Add(new GradientStop(c2, 0.15));
                colorBrush.GradientStops.Add(new GradientStop(baseColor, 0.85));
                colorBrush.GradientStops.Add(new GradientStop(c2, 1));

                return colorBrush;
            }
            catch (Exception)
            {
                return Brushes.DarkRed;
            }
        }
Пример #30
0
        public override BitmapBase Draw(Tank tank)
        {
            var outline = new Pen(new SolidColorBrush(Colors.Black), 1);
            var outlineInner = new Pen(new SolidColorBrush(Color.FromArgb(50, 255, 255, 255)), 1);

            var hsv = ColorHSV.FromColor(BackColor.GetColorWpf(tank));
            var brush = new LinearGradientBrush
            {
                GradientStops = new GradientStopCollection
                {
                    new GradientStop(hsv.ToColorWpf(), 0.1),
                    new GradientStop(hsv.ScaleValue(0.56).ToColorWpf(), 0.49),
                    new GradientStop(hsv.ScaleValue(0.39).ToColorWpf(), 0.51),
                    new GradientStop(hsv.ScaleValue(0.56).ToColorWpf(), 0.9),
                },
                StartPoint = new Point(0, 0),
                EndPoint = new Point(0, 1),
            };

            return Ut.NewBitmapWpf(ParentStyle.IconWidth, ParentStyle.IconHeight, dc =>
            {
                dc.DrawRectangle(brush, outline, new Rect(0.5, 1.5, ParentStyle.IconWidth - 1, ParentStyle.IconHeight - 3));
                dc.DrawRectangle(null, outlineInner, new Rect(1.5, 2.5, ParentStyle.IconWidth - 3, ParentStyle.IconHeight - 5));
            }).ToBitmapRam();
        }
Пример #31
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/SilverlightDemo;component/MainPage.xaml", System.UriKind.Relative));
     this.accordionStyle        = ((System.Windows.Style)(this.FindName("accordionStyle")));
     this.tabContentBorderBrush = ((System.Windows.Media.LinearGradientBrush)(this.FindName("tabContentBorderBrush")));
     this.LayoutRoot            = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.sideBar            = ((System.Windows.Controls.Border)(this.FindName("sideBar")));
     this.ListScroller       = ((System.Windows.Controls.ScrollViewer)(this.FindName("ListScroller")));
     this.ListOfSamples      = ((System.Windows.Controls.StackPanel)(this.FindName("ListOfSamples")));
     this.expand             = ((System.Windows.Controls.Accordion)(this.FindName("expand")));
     this.gridSplitter       = ((System.Windows.Controls.GridSplitter)(this.FindName("gridSplitter")));
     this.tabPanel           = ((System.Windows.Controls.TabControl)(this.FindName("tabPanel")));
     this.tabSample          = ((System.Windows.Controls.TabItem)(this.FindName("tabSample")));
     this.mapFrameBorder     = ((System.Windows.Controls.Border)(this.FindName("mapFrameBorder")));
     this.ContentFrame       = ((System.Windows.Controls.Frame)(this.FindName("ContentFrame")));
     this.tabXaml            = ((System.Windows.Controls.TabItem)(this.FindName("tabXaml")));
     this.tabXamlScrollView  = ((System.Windows.Controls.ScrollViewer)(this.FindName("tabXamlScrollView")));
     this.txtXaml            = ((JeffWilcox.SyntaxHighlighting.SyntaxHighlightingTextBlock)(this.FindName("txtXaml")));
     this.tabSrc             = ((System.Windows.Controls.TabItem)(this.FindName("tabSrc")));
     this.tabSrcScrollView   = ((System.Windows.Controls.ScrollViewer)(this.FindName("tabSrcScrollView")));
     this.txtSrc             = ((JeffWilcox.SyntaxHighlighting.SyntaxHighlightingTextBlock)(this.FindName("txtSrc")));
     this.tabSrcVB           = ((System.Windows.Controls.TabItem)(this.FindName("tabSrcVB")));
     this.tabSrcScrollViewVB = ((System.Windows.Controls.ScrollViewer)(this.FindName("tabSrcScrollViewVB")));
     this.txtSrcExplain      = ((System.Windows.Controls.TextBox)(this.FindName("txtSrcExplain")));
     this.SampleCaption      = ((System.Windows.Controls.TextBlock)(this.FindName("SampleCaption")));
 }
Пример #32
0
 public void UpdateFill(CoreColor min, CoreColor max)
 {
     Background = new LinearGradientBrush
     {
         StartPoint = new Point(0, 0),
         EndPoint = new Point(0, 1),
         GradientStops = new GradientStopCollection
         {
             new GradientStop
             {
                 Color = new Color
                 {
                     A = min.A,
                     R = min.R,
                     G = min.G,
                     B = min.B
                 },
                 Offset = 0
             },
             new GradientStop
             {
                 Color = new Color
                 {
                     A = max.A,
                     R = max.R,
                     G = max.G,
                     B = max.B
                 },
                 Offset = 1
             }
         }
     };
 }
Пример #33
0
 public LinearGradientAnimation(LinearGradientBrush toValue, Duration duration, FillBehavior fillBehavior)
     : this()
 {
     this.To = toValue;
     base.Duration = duration;
     base.FillBehavior = fillBehavior;
 }
 public void setBackground()
 {
     Point p1 = new Point(0,0);
     Point p2 = new Point(1.5,1);
     switch (strFertigungsstatus)
     {
         case "Planung":
             Background = new LinearGradientBrush(Colors.Orange,Colors.Transparent,p1,p2);
             break;
         case "Montage":
             Background = new LinearGradientBrush(Colors.MediumTurquoise,Colors.Transparent,p1,p2);
             break;
         case "Prüfbereit":
             Background = new LinearGradientBrush(Colors.Orchid,Colors.Transparent,p1,p2);
             break;
         case "Prüfung":
             Background = new LinearGradientBrush(Colors.DeepSkyBlue,Colors.Transparent,p1,p2);
             break;
         case "Komplettierung":
             Background = new LinearGradientBrush(Colors.LightSkyBlue,Colors.Transparent,p1,p2);
             break;
         case "Versendet":
             Background = new LinearGradientBrush(Colors.GreenYellow,Colors.Transparent,p1,p2);
             break;
         default:
             Background = new LinearGradientBrush(Colors.White,Colors.Transparent,p1,p2);
             break;
     }
 }
        public static GradientBrush Convert(System.Windows.Media.Color color)
        {
            var scrgb = color.ToScRGBColor();

            var xyz = KnownColorSpaces.scRGB.ToXYZColor(scrgb);

            var lab = KnownColorSpaces.Lab.FromXYZColor(xyz) as LabColor;

            var l_base = lab.L;

            var gradientStops = new GradientStopCollection();

            var _lab = new LabColor(0xff, l_base * 1.07, lab.a, lab.b);
            var _c = _lab.ToWindowsMediaColor();

            gradientStops.Add(new GradientStop(_c, 0.5));


            _lab = new LabColor(0xff, l_base * .93, lab.a, lab.b);
            _c = _lab.ToWindowsMediaColor();

            gradientStops.Add(new GradientStop(_c, 1));


            var result = new LinearGradientBrush(gradientStops, 90);

            result.Freeze();

            return result;
        }
Пример #36
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ra1 = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 2:
                this.ra2 = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 3:
                this.ra3 = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 4:
                this.ra4 = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 5:
                this.buttonStart = ((System.Windows.Controls.Button)(target));

            #line 62 "..\..\MainWindow.xaml"
                this.buttonStart.Click += new System.Windows.RoutedEventHandler(this.buttonStart_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #37
0
 /// <summary>
 ///     Set brush
 /// </summary>
 /// <param name="LinearGradientBrush">Linear gradient brush</param>
 /// <remarks>This method sets BrushOpacity.</remarks>
 public void SetBrush
 (
     SysMedia.LinearGradientBrush LinearGradientBrush
 )
 {
     NonStroking  = LinearGradientBrush;
     BrushOpacity = LinearGradientBrush.Opacity;
 }
Пример #38
0
        /// <summary>
        ///    Window Loaded
        /// </summary>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // -------------------------
            // Color the Pallette
            // -------------------------
            // Darkness
            System.Windows.Media.LinearGradientBrush gradientBlack = new System.Windows.Media.LinearGradientBrush();
            gradientBlack.StartPoint = new System.Windows.Point(0, 0);
            gradientBlack.EndPoint   = new System.Windows.Point(0, 1);
            gradientBlack.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0, 0, 0, 0), 0));   // transparent black
            gradientBlack.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(255, 0, 0, 0), 1)); // black

            shadeDarkness.Fill = gradientBlack;

            // -------------------------
            // Set Shade Ellipse Position
            // -------------------------
            // If null, default Center
            if (ellipseX == 0 || ellipseY == 0)
            {
                // Center Middle
                Canvas.SetLeft(shadePickerElipse, (shadeCanvas.Height / 2) - 6);
                Canvas.SetTop(shadePickerElipse, (shadeCanvas.Height / 2) - 6);
            }
            // Load last position
            else
            {
                Canvas.SetLeft(shadePickerElipse, ColorPickerWindow.ellipseX);
                Canvas.SetTop(shadePickerElipse, ColorPickerWindow.ellipseY);
            }

            // -------------------------
            // Ellipse Dark Light
            // -------------------------
            // Change Ellipse color based on location
            shadeEllipseDarkLight();


            // -------------------------
            // Initial Color
            // -------------------------
            // If null, default
            if (ColorPickerWindow.spectrumValue == 0)
            {
                GetSpectrumColor();
            }
            // Load last used color position
            else
            {
                slHue.Value = ColorPickerWindow.spectrumValue;
            }


            // -------------------------
            // Set Color
            // -------------------------
            SetColor(spectrumColor);
        }
Пример #39
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Grid = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.ctxMenu = ((System.Windows.Controls.ContextMenu)(target));
                return;

            case 3:
                this.ctxMenu_AddContact = ((System.Windows.Controls.MenuItem)(target));

            #line 12 "..\..\..\Items\ItemGroup.xaml"
                this.ctxMenu_AddContact.Click += new System.Windows.RoutedEventHandler(this.ctxMenu_AddContact_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.ctxMenu_EditGroup = ((System.Windows.Controls.MenuItem)(target));

            #line 18 "..\..\..\Items\ItemGroup.xaml"
                this.ctxMenu_EditGroup.Click += new System.Windows.RoutedEventHandler(this.ctxMenu_EditGroup_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.ctxMenu_DeleteGroup = ((System.Windows.Controls.MenuItem)(target));

            #line 23 "..\..\..\Items\ItemGroup.xaml"
                this.ctxMenu_DeleteGroup.Click += new System.Windows.RoutedEventHandler(this.ctxMenu_DeleteGroup_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.GridGradien = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 7:
                this.GridGradienStop = ((System.Windows.Media.GradientStop)(target));
                return;

            case 8:
                this.labelDisplayName = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #40
0
 /// <summary>
 /// PDF axial shading constructor for unit bounding box
 /// </summary>
 /// <param name="Document">Parent PDF document object</param>
 /// <param name="MediaBrush">System.Windows.Media brush</param>
 public PdfAxialShading
 (
     PdfDocument Document,
     SysMedia.LinearGradientBrush MediaBrush
 ) : this(Document, 0.0, 0.0, 1.0, 1.0, new PdfShadingFunction(Document, MediaBrush))
 {
     SetAxisDirection(MediaBrush.StartPoint.X, MediaBrush.StartPoint.Y, MediaBrush.EndPoint.X, MediaBrush.EndPoint.Y,
                      MediaBrush.MappingMode == SysMedia.BrushMappingMode.RelativeToBoundingBox ? MappingMode.Relative : MappingMode.Absolute);
     return;
 }
Пример #41
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/gMVVM;component/Views/SystemRole/CaptChaControl.xaml", System.UriKind.Relative));
     this.LayoutRoot        = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.CaptchaBackground = ((System.Windows.Media.LinearGradientBrush)(this.FindName("CaptchaBackground")));
 }
Пример #42
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Color)
            {
                Color  cColor      = (Color)value;
                string TragetColor = string.Format(@"#{0:X2}{1:X2}{2:X2}{3:X2}",
                                                   cColor.A, cColor.R, cColor.G, cColor.B);
                return(TragetColor);
            }
            if (value is StyleColor)
            {
                var sc = (StyleColor)value;
                if (sc.FillType == ColorFillType.Solid)
                {
                    return(new System.Windows.Media.SolidColorBrush(this.FromArgb(sc.ARGB)));
                }
                else if (sc.FillType == ColorFillType.Gradient)
                {
                    var lineb = new System.Windows.Media.LinearGradientBrush();
                    lineb.StartPoint = new System.Windows.Point(0d, 0.5d);
                    lineb.EndPoint   = new System.Windows.Point(1d, 0.5d);
                    var newFrames = sc.Frames;
                    if (newFrames == null || newFrames.Count == 0)
                    {
                        newFrames    = new Dictionary <double, int>();
                        newFrames[0] = -1;
                        newFrames[1] = -16777216;
                    }
                    foreach (var keypair in newFrames)
                    {
                        var gradientStop = new System.Windows.Media.GradientStop(
                            this.FromArgb(keypair.Value),
                            keypair.Key);
                        lineb.GradientStops.Add(gradientStop);
                    }

                    var aRotateTransform = new System.Windows.Media.RotateTransform();
                    aRotateTransform.CenterX = 0.5;
                    aRotateTransform.CenterY = 0.5;
                    aRotateTransform.Angle   = sc.Angle;
                    lineb.RelativeTransform  = aRotateTransform;
                    return(lineb);
                }
            }

            else
            {
                return(new System.Windows.Media.SolidColorBrush(Color.FromArgb(0, 255, 255, 255)));
            }


            return(Brushes.White);
        }
Пример #43
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Method draws a line with specified parameters.
        /// </summary>
        /// <param name="canvas"></param>
        /// <param name="x1">starting x-coordinate of line segment</param>
        /// <param name="x2">ending x-coordinate of line segment</param>
        /// <param name="y1">starting y-coordinate of line segment</param>
        /// <param name="y2">ending y-coordinate of line segment</param>
        /// <param name="thickness">stroke thickness of line segment</param>
        private static void drawMyLine(Canvas canvas, double x1, double x2, double y1, double y2, double thickness)
        {
            // RNG.
            Random random = new Random();

            // Constraints.
            double strokeThicknessMin = 1.0;
            double strokeThicknessMax = 1.2;

            // Generate random numbers. (not used in current implementation)
            double randomStrokeThickness = random.NextDouble() * (strokeThicknessMax - strokeThicknessMin) + strokeThicknessMin;

            int randomAlpha = random.Next(200, 250);
            int randomRed   = random.Next(200, 220);
            int randomGreen = random.Next(245, 255);
            int randomBlue  = random.Next(250, 255);

            // Create a horizontal linear gradient.
            System.Windows.Media.LinearGradientBrush horizontalGradientBrush =
                new System.Windows.Media.LinearGradientBrush();

            // Set the starting and ending point of the stops. (controls angle of gradient)
            horizontalGradientBrush.StartPoint = new System.Windows.Point(0, 0.5);
            horizontalGradientBrush.EndPoint   = new System.Windows.Point(1, 0.5);

            // Create four gradient stops.
            horizontalGradientBrush.GradientStops.Add(new GradientStop(Colors.GreenYellow, 0.0));
            horizontalGradientBrush.GradientStops.Add(new GradientStop(Colors.Green, 0.25));
            horizontalGradientBrush.GradientStops.Add(new GradientStop(Colors.ForestGreen, 0.75));
            horizontalGradientBrush.GradientStops.Add(new GradientStop(Colors.DarkSeaGreen, 1.0));

            // Create a SolidColorBrush with a single color.
            SolidColorBrush mySolidColorBrush = new SolidColorBrush();

            mySolidColorBrush.Color = System.Windows.Media.Color.FromArgb(Convert.ToByte(randomAlpha), Convert.ToByte(randomRed), Convert.ToByte(randomGreen), Convert.ToByte(randomBlue));

            // Settings for the line.
            Line myLine = new Line();

            myLine.X1                  = x1;
            myLine.Y1                  = y1;
            myLine.X2                  = x2;
            myLine.Y2                  = y2;
            myLine.Stroke              = horizontalGradientBrush;
            myLine.VerticalAlignment   = VerticalAlignment.Center;
            myLine.HorizontalAlignment = HorizontalAlignment.Left;
            myLine.StrokeThickness     = thickness;

            // Draw to canvas.
            canvas.Children.Add(myLine);
        }
Пример #44
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.border = ((System.Windows.Controls.Border)(target));
                return;

            case 2:
                this.StrokeColor = ((System.Windows.Media.LinearGradientBrush)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #45
0
        private LinearGradientBrush GetStripesBrush(Color color)
        {
            GradientStopCollection gradientStopCollection = new GradientStopCollection();

            gradientStopCollection.Add(new GradientStop(color, 0));
            gradientStopCollection.Add(new GradientStop(color, 0.4));
            gradientStopCollection.Add(new GradientStop(Colors.White, 0.4));
            gradientStopCollection.Add(new GradientStop(Colors.White, 1));
            System.Windows.Media.LinearGradientBrush returnValue =
                new System.Windows.Media.LinearGradientBrush(gradientStopCollection, new Point(0, 0), new Point(0, 1));
            returnValue.SpreadMethod      = GradientSpreadMethod.Repeat;
            returnValue.RelativeTransform = new ScaleTransform(0.09, 0.09);
            return(returnValue);
        }
Пример #46
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            scale = Template.FindName("PART_Scale", this) as Border;
            Media.LinearGradientBrush lgb = new Media.LinearGradientBrush();
            lgb.StartPoint = new System.Windows.Point(0.5, 1.0);
            lgb.EndPoint   = new System.Windows.Point(0.5, 0.0);
            if (scale != null)
            {
                if (ColorScale == SliderScaleEnum.L || ColorScale == SliderScaleEnum.W)
                {
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Colors.Black, 0.0));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Colors.LightGray, 1.0));
                    scale.Background = lgb;
                }
                if (ColorScale == SliderScaleEnum.H || ColorScale == SliderScaleEnum.S)
                {
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Colors.Black, 0.0));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Colors.Black, 1.0));
                    scale.Background = lgb;
                }
                if (ColorScale == SliderScaleEnum.Cold)
                {
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(0, 0, 0x75), 0.0));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Colors.Cyan, 1.0));
                    scale.Background = lgb;
                }
                if (ColorScale == SliderScaleEnum.Warm)
                {
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(0xAD, 0x3D, 0), 0.0));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Colors.Orange, 1.0));
                    scale.Background = lgb;
                }
                if (ColorScale == SliderScaleEnum.T)
                {
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(255, 0, 0), 0.0));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(255, 85, 0), 0.1666));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(255, 170, 0), 0.3333));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(255, 255, 0), 0.483));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(0, 255, 255), 0.5));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(0, 128, 255), 0.6666));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(0, 0, 255), 0.83333));
                    lgb.GradientStops.Add(new Media.GradientStop(Media.Color.FromRgb(128, 0, 255), 1.0));

                    scale.Background = lgb;
                }
            }
        }
 public static System.Drawing.Brush AsDrawingBrush(this System.Windows.Media.Brush brush)
 {
     System.Drawing.Brush drawingBrush = System.Drawing.Brushes.Black;
     if (brush is System.Windows.Media.LinearGradientBrush)
     {
         System.Windows.Media.LinearGradientBrush linearBrush = brush as System.Windows.Media.LinearGradientBrush;
         drawingBrush = new System.Drawing.Drawing2D.LinearGradientBrush(linearBrush.StartPoint.AsDrawingPoint(), linearBrush.EndPoint.AsDrawingPoint(), linearBrush.GradientStops[0].Color.AsDrawingColor(), linearBrush.GradientStops[1].Color.AsDrawingColor());
         return(drawingBrush);
     }
     else if (brush is System.Windows.Media.SolidColorBrush)
     {
         drawingBrush = (brush as System.Windows.Media.SolidColorBrush).Color.AsDrawingBrush();
         return(drawingBrush);
     }
     return(drawingBrush);
 }
Пример #48
0
        public EditMenu(ref SketchPanel sp, CommandManagement.CommandManager commandManager)
        {
            sketchPanel         = sp;
            activeButtonList    = new List <Popup>();
            this.commandManager = commandManager;
            visible             = false;
            labelFuncSet        = false;
            overButton          = false;
            drawPoint           = new Point();

            #region Initialize the images for undo/redo, brush effects

            undoImage = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage undoBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                   (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\UndoIcon.bmp")));
            undoImage.Source = undoBitmap;

            redoImage = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage redoBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                   (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\RedoIcon.bmp")));
            redoImage.Source = redoBitmap;

            undoImageGray = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage undoGrayBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                       (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\UndoIconGray.bmp")));
            undoImageGray.Source = undoGrayBitmap;

            redoImageGray = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage redoGrayBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                       (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\RedoIconGray.bmp")));
            redoImageGray.Source = redoGrayBitmap;

            // Initialize Button Effects and Brushes
            highlightBrush = new System.Windows.Media.LinearGradientBrush(System.Windows.Media.Colors.White, System.Windows.Media.Colors.SkyBlue,
                                                                          new System.Windows.Point(0, 0), new System.Windows.Point(0, 1));
            normalBrush = new System.Windows.Media.LinearGradientBrush(System.Windows.Media.Colors.White, System.Windows.Media.Colors.Silver,
                                                                       new System.Windows.Point(0, 0), new System.Windows.Point(0, 1));

            highlightEffect             = new System.Windows.Media.Effects.DropShadowEffect();
            highlightEffect.ShadowDepth = 1.0;
            highlightEffect.Color       = System.Windows.Media.Colors.Silver;

            #endregion

            InitializeLabelMenu();
        }
Пример #49
0
        /// <summary>
        ///   Set Shade Base Color
        /// </summary>
        public void SetShadeBaseColor(System.Drawing.Color color)
        {
            // -------------------------
            // Shade Base Color
            // -------------------------
            // Gradient White to Color
            System.Windows.Media.LinearGradientBrush brushBaseColor = new System.Windows.Media.LinearGradientBrush();
            brushBaseColor.StartPoint = new System.Windows.Point(0, 0);
            brushBaseColor.EndPoint   = new System.Windows.Point(1, 0);
            brushBaseColor.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(255, 255, 255, 255), 0));                 // white
            brushBaseColor.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B), 1)); // base color

            shadeBase.Fill = brushBaseColor;

            // -------------------------
            // Set Color
            // -------------------------
            SetColor(color);
        }
Пример #50
0
        protected override void UpdateBackground()
        {
            // background color change must be handled separately
            // because the background would protrude through the border if the corners are rounded
            // as the background would be applied to the renderer's FrameworkElement
            var pancake = (PancakeView)Element;

            if (Control != null)
            {
                if (pancake.BackgroundGradientStops != null && pancake.BackgroundGradientStops.Any())
                {
                    // Create a gradient layer that draws our background.
                    if (pancake.BackgroundGradientStops != null && pancake.BackgroundGradientStops.Count > 0)
                    {
                        // A range of colors is given. Let's add them.
                        var orderedStops = pancake.BackgroundGradientStops.OrderBy(x => x.Offset).ToList();
                        var gc           = new System.Windows.Media.GradientStopCollection();

                        foreach (var item in orderedStops)
                        {
                            gc.Add(new System.Windows.Media.GradientStop {
                                Offset = item.Offset, Color = item.Color.ToMediaColor()
                            });
                        }

                        var gradient = new System.Windows.Media.LinearGradientBrush(gc, 0)
                        {
                            StartPoint = new System.Windows.Point(pancake.BackgroundGradientStartPoint.X,
                                                                  pancake.BackgroundGradientStartPoint.Y),
                            EndPoint = new System.Windows.Point(pancake.BackgroundGradientEndPoint.X,
                                                                pancake.BackgroundGradientEndPoint.Y)
                        };

                        this.Control.Background = gradient;
                    }
                }
                else
                {
                    Control.Background = Element.BackgroundColor.IsDefault ? null : Element.BackgroundColor.ToBrush();
                }
            }
        }
Пример #51
0
        /*****************************************************************************/

        #region Public Methods

        public void UpdateScaleGradient(ColorRange cr)
        {
            //ExternalCall = true;
            blockChangeValue = true;
            Media.LinearGradientBrush lgb = new Media.LinearGradientBrush();
            if (ColorScale == SliderScaleEnum.H)
            {
                lgb.GradientStops.Add(new Media.GradientStop(cr.ToColor, 0.0));
                lgb.GradientStops.Add(new Media.GradientStop(cr.FromColor, 1.0));
                if (scale != null)
                {
                    scale.Background = lgb;
                }
                Minimum     = cr.HueMinimum;
                Maximum     = cr.HueMaximum;
                SmallChange = (Maximum - Minimum) / 100.0;
                LargeChange = SmallChange * 10;
            }
            //ExternalCall = false;
            blockChangeValue = false;
        }
        public object Convert(object value, Type targetType, object parameter,
                              System.Globalization.CultureInfo culture)
        {
            System.Windows.Media.LinearGradientBrush brush = null;
            if ((bool)value)
            {
                brush            = new System.Windows.Media.LinearGradientBrush();
                brush.StartPoint = new System.Windows.Point(0, 0);
                brush.EndPoint   = new System.Windows.Point(1, 0);

                // Create and add Gradient stops
                GradientStop blueGS = new GradientStop();
                blueGS.Color  = System.Windows.Media.Color.FromArgb(255, 255, 209, 111);
                blueGS.Offset = 0.0;
                brush.GradientStops.Add(blueGS);

                GradientStop blueGS1 = new GradientStop();
                blueGS1.Color  = System.Windows.Media.Color.FromArgb(255, 245, 200, 112);
                blueGS1.Offset = 1.0;
                brush.GradientStops.Add(blueGS1);
            }
            else
            {
                brush            = new System.Windows.Media.LinearGradientBrush();
                brush.StartPoint = new System.Windows.Point(0, 0);
                brush.EndPoint   = new System.Windows.Point(1, 0);

                // Create and add Gradient stops
                GradientStop blueGS = new GradientStop();
                blueGS.Color  = System.Windows.Media.Color.FromArgb(255, 239, 239, 239);
                blueGS.Offset = 0.0;
                brush.GradientStops.Add(blueGS);

                GradientStop blueGS1 = new GradientStop();
                blueGS1.Color  = System.Windows.Media.Color.FromArgb(255, 245, 245, 245);
                blueGS1.Offset = 1.0;
                brush.GradientStops.Add(blueGS1);
            }
            return(brush);
        }
Пример #53
0
        private void UpdateBorder(PancakeView pancake)
        {
            //// Create the border layer
            if (Control != null && pancake?.Border != null)
            {
                this.Control.BorderThickness = new System.Windows.Thickness(pancake.Border.Thickness);

                if (pancake.Border.GradientStops != null && pancake.Border.GradientStops.Any())
                {
                    // Create a gradient layer that draws our background.
                    if (pancake.Border.GradientStops != null && pancake.Border.GradientStops.Count > 0)
                    {
                        // A range of colors is given. Let's add them.
                        var orderedStops = pancake.Border.GradientStops.OrderBy(x => x.Offset).ToList();
                        var gc           = new System.Windows.Media.GradientStopCollection();

                        foreach (var item in orderedStops)
                        {
                            gc.Add(new System.Windows.Media.GradientStop {
                                Offset = item.Offset, Color = item.Color.ToMediaColor()
                            });
                        }

                        var gradient = new System.Windows.Media.LinearGradientBrush(gc, 0)
                        {
                            StartPoint = new System.Windows.Point(pancake.Border.GradientStartPoint.X,
                                                                  pancake.Border.GradientStartPoint.Y),
                            EndPoint = new System.Windows.Point(pancake.Border.GradientEndPoint.X,
                                                                pancake.Border.GradientEndPoint.Y)
                        };

                        this.Control.BorderBrush = gradient;
                    }
                }
                else
                {
                    this.Control.BorderBrush = pancake.Border.Color.IsDefault ? null : pancake.Border.Color.ToBrush();
                }
            }
        }
Пример #54
0
        public static System.Windows.Media.Color ToColor(this StyleColor sc)
        {
            if (sc.FillType == ColorFillType.Solid)
            {
                return(StyleColorExtension.FromArgb(sc.ARGB));
            }
            else if (sc.FillType == ColorFillType.Gradient)
            {
                var lineb     = new System.Windows.Media.LinearGradientBrush();
                var newFrames = sc.Frames;
                if (newFrames == null || newFrames.Count == 0)
                {
                    newFrames    = new Dictionary <double, int>();
                    newFrames[0] = -1;
                    newFrames[1] = -16777216;
                }

                return(FromArgb(newFrames.First().Value));
            }

            return(default(System.Windows.Media.Color));
        }
Пример #55
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 19 "..\..\Window1.xaml"
                ((System.Windows.Controls.CheckBox)(target)).Click += new System.Windows.RoutedEventHandler(this.OnClick);

            #line default
            #line hidden
                return;

            case 2:
                this.DesignerCanvas = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.label = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.rotation = ((System.Windows.Media.RotateTransform)(target));
                return;

            case 5:
                this.mediaElement = ((System.Windows.Controls.MediaElement)(target));
                return;

            case 6:
                this.polyLine = ((System.Windows.Shapes.Path)(target));
                return;

            case 7:
                this.backgroundBrush = ((System.Windows.Media.LinearGradientBrush)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #56
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Glicious;component/VenuesPage.xaml", System.UriKind.Relative));
     this.LayoutRoot   = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.grad         = ((System.Windows.Media.LinearGradientBrush)(this.FindName("grad")));
     this.gradStart    = ((System.Windows.Media.GradientStop)(this.FindName("gradStart")));
     this.gradStop     = ((System.Windows.Media.GradientStop)(this.FindName("gradStop")));
     this.TitlePanel   = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.meal         = ((System.Windows.Controls.TextBlock)(this.FindName("meal")));
     this.PgTitle      = ((System.Windows.Controls.TextBlock)(this.FindName("PgTitle")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.grad2start   = ((System.Windows.Media.GradientStop)(this.FindName("grad2start")));
     this.grad2stop    = ((System.Windows.Media.GradientStop)(this.FindName("grad2stop")));
     this.listBox      = ((System.Windows.Controls.ListBox)(this.FindName("listBox")));
     this.textBlock1   = ((System.Windows.Controls.TextBlock)(this.FindName("textBlock1")));
     this.date         = ((System.Windows.Controls.TextBlock)(this.FindName("date")));
     this.datePicker   = ((Microsoft.Phone.Controls.DatePicker)(this.FindName("datePicker")));
     this.border1      = ((System.Windows.Controls.Border)(this.FindName("border1")));
 }
Пример #57
0
        private static void OnHueValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Media.Color color, color1;
            Media.LinearGradientBrush lgb;

            HslSlider slider = d as HslSlider;

            if (slider.ColorScale == SliderScaleEnum.S)
            {
                lgb            = new Media.LinearGradientBrush();
                lgb.StartPoint = new Point(0.5, 1.0);
                lgb.EndPoint   = new Point(0.5, 0.0);
                color          = ColorUtilities.Hsl2MediaColor(slider.HueValue, 0.0, 0.5);
                color1         = ColorUtilities.Hsl2MediaColor(slider.HueValue, 1.0, 0.5);

                lgb.GradientStops.Add(new Media.GradientStop(color, 0.0));
                lgb.GradientStops.Add(new Media.GradientStop(color1, 1.0));

                if (slider.scale != null)
                {
                    slider.scale.Background = lgb;
                }
            }
        }
Пример #58
0
        /// <summary>
        /// Returns a Windows brush from the NGraphics brush
        /// </summary>
        /// <param name="fromBrush"></param>
        /// <returns></returns>
        private System.Windows.Media.Brush GetBrush(NGraphics.Brush fromBrush)
        {
            var sb = fromBrush as SolidBrush;

            if (sb != null)
            {
                // Solid brush
                return(new SolidColorBrush(new System.Windows.Media.Color
                {
                    A = sb.Color.A,
                    R = sb.Color.R,
                    G = sb.Color.G,
                    B = sb.Color.B
                }));
            }

            var lb = fromBrush as NGraphics.LinearGradientBrush;

            if (lb != null)
            {
                // Linear gradient
                var gradStops = new GradientStopCollection();
                var n         = lb.Stops.Count;
                if (n >= 2)
                {
                    var locs  = new float[n];
                    var comps = new int[n];
                    for (var i = 0; i < n; i++)
                    {
                        var s = lb.Stops[i];
                        gradStops.Add(new System.Windows.Media.GradientStop
                        {
                            Color = new System.Windows.Media.Color
                            {
                                A = s.Color.A,
                                R = s.Color.R,
                                B = s.Color.B,
                                G = s.Color.G,
                            },
                            Offset = s.Offset,
                        });
                    }
                }

                var grad = new System.Windows.Media.LinearGradientBrush(gradStops, 90);
                return(grad);
            }

            var rb = fromBrush as NGraphics.RadialGradientBrush;

            if (rb != null)
            {
                // Radial gradient
                var grad = new System.Windows.Media.RadialGradientBrush();
                var n    = rb.Stops.Count;
                if (n >= 2)
                {
                    var locs  = new float[n];
                    var comps = new int[n];
                    for (var i = 0; i < n; i++)
                    {
                        var s = rb.Stops[i];
                        grad.GradientStops.Add(new System.Windows.Media.GradientStop
                        {
                            Color = new System.Windows.Media.Color
                            {
                                A = s.Color.A,
                                R = s.Color.R,
                                B = s.Color.B,
                                G = s.Color.G,
                            },
                            Offset = s.Offset,
                        });
                    }
                }
                return(grad);
            }

            return(null);
        }
Пример #59
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 6 "..\..\..\SuperMarket.xaml"
                ((OnlineTradingSystem.Window1)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Window_MouseDown);

            #line default
            #line hidden
                return;

            case 2:
                this.labelSuperMarket = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.label2 = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.MySolidColorBrush = ((System.Windows.Media.LinearGradientBrush)(target));
                return;

            case 5:
                this.label3 = ((System.Windows.Controls.Label)(target));

            #line 67 "..\..\..\SuperMarket.xaml"
                this.label3.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.label3_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 6:
                this.image1 = ((System.Windows.Controls.Image)(target));
                return;

            case 7:
                this.canvas1 = ((System.Windows.Controls.Canvas)(target));
                return;

            case 8:
                this.image2 = ((System.Windows.Controls.Image)(target));

            #line 70 "..\..\..\SuperMarket.xaml"
                this.image2.MouseEnter += new System.Windows.Input.MouseEventHandler(this.image2_MouseEnter);

            #line default
            #line hidden
                return;

            case 9:
                this.Enterlabel = ((System.Windows.Controls.Label)(target));

            #line 72 "..\..\..\SuperMarket.xaml"
                this.Enterlabel.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Enterlabel_MouseDown);

            #line default
            #line hidden
                return;

            case 10:
                this.textBlock1 = ((System.Windows.Controls.TextBlock)(target));

            #line 88 "..\..\..\SuperMarket.xaml"
                this.textBlock1.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.textBlock1_MouseDown);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #60
0
        internal override WpfBrush RealizeWpfBrush()
        {
            //if (dirty)
            //{
            //  if (brush == null)
            //    brush = new SolidBrush(color.ToGdiColor());
            //  else
            //  {
            //    brush.Color = color.ToGdiColor();
            //  }
            //  dirty = false;
            //}

            System.Windows.Media.LinearGradientBrush brush;
            if (_useRect)
            {
#if !SILVERLIGHT
                brush = new System.Windows.Media.LinearGradientBrush(_color1.ToWpfColor(), _color2.ToWpfColor(), new SysPoint(0, 0), new SysPoint(1, 1));// rect.TopLeft, this.rect.BottomRight);
                //brush = new System.Drawing.Drawing2D.LinearGradientBrush(rect.ToRectangleF(),
                //  color1.ToGdiColor(), color2.ToGdiColor(), (LinearGradientMode)linearGradientMode);
#else
                GradientStop gs1 = new GradientStop();
                gs1.Color  = _color1.ToWpfColor();
                gs1.Offset = 0;

                GradientStop gs2 = new GradientStop();
                gs2.Color  = _color2.ToWpfColor();
                gs2.Offset = 1;

                GradientStopCollection gsc = new GradientStopCollection();
                gsc.Add(gs1);
                gsc.Add(gs2);

                brush            = new LinearGradientBrush(gsc, 0);
                brush.StartPoint = new Point(0, 0);
                brush.EndPoint   = new Point(1, 1);
#endif
            }
            else
            {
#if !SILVERLIGHT
                brush = new System.Windows.Media.LinearGradientBrush(_color1.ToWpfColor(), _color2.ToWpfColor(), _point1, _point2);
                //brush = new System.Drawing.Drawing2D.LinearGradientBrush(
                //  point1.ToPointF(), point2.ToPointF(),
                //  color1.ToGdiColor(), color2.ToGdiColor());
#else
                GradientStop gs1 = new GradientStop();
                gs1.Color  = _color1.ToWpfColor();
                gs1.Offset = 0;

                GradientStop gs2 = new GradientStop();
                gs2.Color  = _color2.ToWpfColor();
                gs2.Offset = 1;

                GradientStopCollection gsc = new GradientStopCollection();
                gsc.Add(gs1);
                gsc.Add(gs2);

                brush            = new LinearGradientBrush(gsc, 0);
                brush.StartPoint = _point1;
                brush.EndPoint   = _point2;
#endif
            }
            if (!_matrix.IsIdentity)
            {
#if !SILVERLIGHT
                brush.Transform = new MatrixTransform(_matrix.ToWpfMatrix());
#else
                MatrixTransform transform = new MatrixTransform();
                transform.Matrix = _matrix.ToWpfMatrix();
                brush.Transform  = transform;
#endif
            }
            return(brush);
        }