public GridSquare(Point Location, Colors TileColor, Status Occupied)
        {
            panel = new GridPanel(this);
            this.Location = Location;
            this.TileColor = TileColor;
            this.Occupied = Occupied;

            this.Size = defaultTileSize;
        }
        public GridSquare(Point Location, Colors TileColor, Status Occupied, int n, int m)
        {
            panel = new GridPanel(this);
            this.Location = Location;
            this.TileColor = TileColor;
            this.Occupied = Occupied;

            this.PositionX = n;
            this.PositionY = m;

            this.Size = defaultTileSize;

               // Draw();
        }
 DependencyProperty.Register("SegmentColor", typeof(Brush), typeof(PieChart), new PropertyMetadata(new SolidColorBrush(Colors.Green),
     (o, args) =>
예제 #4
0
        public void ChangeColor(Colors new_color)
        {
            color = new_color;
            
            // Reset shouldChangeColor:
            shouldChangeColor = -1;

            // Change colorRects color:
            LinearGradientBrush gradientBrush = new LinearGradientBrush();
            gradientBrush.StartPoint = new Point(0.5, 0);
            gradientBrush.EndPoint = new Point(0.5, 1);

            if (new_color == Colors.Red)
            {
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0, 255, 200, 0), 0));
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(255, 255, 0, 0), 1.0));
            }
            else if (new_color == Colors.Green)
            {
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0, 0, 255, 200), 0));
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(255, 0, 255, 0), 1.0));
            }
            else if (new_color == Colors.Blue)
            {
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0, 200, 0, 255), 0));
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(255, 0, 0, 255), 1.0));
            }
            else if (new_color == Colors.White)
            {
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0, 250, 250, 250), 0));
                gradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(255, 100, 100, 100), 1.0));
            }
            
            // Change color indicator:
            //colorRect.Fill = gradientBrush;
        }