Ejemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            RoundedRectangle rect = new RoundedRectangle(0, 0,
                                                         this.Width, this.Height, 10);

            if (_map == null)
            {
                _map = new Bitmap(this.Width, this.Height);
            }
            Graphics g = Graphics.FromImage(_map);

            rect.Shrink(5);
            Border.Border border = new Border.Border3D();
            border.DrawBorder(g, rect.GetGraphicsPath());
            g.Clip = new Region(rect.GetGraphicsPath());
            Pen p = new Pen(Color.DarkGray);
            LinearGradientBrush b = new LinearGradientBrush(rect.ClientRect, Color.WhiteSmoke, _backColor, 90f);

            g.FillPath(b, rect.GetGraphicsPath());
            g.DrawPath(p, rect.GetGraphicsPath());
            if (_backImage != null)
            {
                g.DrawImage(_backImage, rect.ClientRect);
            }
            _bar = new Rectangle(rect.Left + 10, rect.Top + rect.Height / 2 - _barThinkness / 2, rect.Width - 20, _barThinkness);

            RoundedRectangle r2 = new RoundedRectangle(_bar, 5);

            if (_collection.Count > 2)
            {
                float temp = r2.Width / (_collection.Count - 1);
                if (temp >= 1)
                {
                    _interval = temp;
                }
            }
            else
            {
                _interval = r2.Width;
            }

            b.LinearColors = new Color[] { Color.Gray, Color.DarkGray };
            g.FillPath(b, r2.GetGraphicsPath());
            DrawMarking(g, _bar);
            if (_drag == null)
            {
                _drag = new Dragger(r2.ClientRect, Dragger.DragPosition.Horizontal);
            }
            if (_drag != null)
            {
                _drag.NormalColor   = _pointerBodyColor;
                _drag.SelectedColor = _pointerHoverColor;
                _drag.PointerColor  = _pointerColor;
            }
            _drag.draw(g);
            e.Graphics.DrawImage(_map, 0, 0);
        }
Ejemplo n.º 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            RoundedRectangle rect = new RoundedRectangle(0, 0,
                                                         this.Width, this.Height, 10);

            if (_map == null)
            {
                _map = new Bitmap(this.Width, this.Height);
            }
            Graphics g = Graphics.FromImage(_map);

            rect.Shrink(5);
            Border.Border border = new Border.Border3D();
            border.DrawBorder(g, rect.GetGraphicsPath());
            Pen p = new Pen(Color.WhiteSmoke);
            LinearGradientBrush b = new LinearGradientBrush(rect.ClientRect, Color.WhiteSmoke, _backColor, 90f);

            g.FillPath(b, rect.GetGraphicsPath());
            g.DrawPath(p, rect.GetGraphicsPath());
            g.Clip = new Region(rect.GetGraphicsPath());
            if (_backImage != null)
            {
                g.DrawImage(_backImage, rect.ClientRect);
            }
            g.ResetClip();
            rect.Shrink(10);
            if (_panel != null)
            {
                _panel.Left               = rect.ClientRect.Left;
                _panel.Top                = rect.ClientRect.Top;
                _panel.Width              = rect.ClientRect.Width;
                _panel.Height             = rect.ClientRect.Height;
                _panel.DisplayValue       = _displayValue;
                _panel.DisplayFont        = _font;
                _panel.SweepAngle         = _sweepAngle;
                _panel.StartAngle         = _startGapAngle;
                _panel.PointerColor       = _pointerColor;
                _panel.PointerHandleColor = _pointerHandleColor;
                _panel.FontColor          = _fontColor;
                _panel.InnerBoderRing     = _border;
            }
            _panel.Draw(g);
            e.Graphics.DrawImage(_map, new Point(0, 0));
        }
Ejemplo n.º 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            RoundedRectangle rect = new RoundedRectangle(0, 0,
                                                         this.Width, this.Height, 10);

            if (_map == null)
            {
                _map = new Bitmap(this.Width, this.Height);
            }
            Graphics g = Graphics.FromImage(_map);

            rect.Shrink(5);
            Border.Border border = new Border.Border3D();
            border.DrawBorder(g, rect.GetGraphicsPath());
            g.Clip = new Region(rect.GetGraphicsPath());
            PathGradientBrush pb = new PathGradientBrush(rect.GetGraphicsPath());

            if (_mouseDown == false)
            {
                pb.CenterColor    = Color.White;
                pb.SurroundColors = new Color[] { _backcolor };
                pb.CenterPoint    = new PointF(-2f, -2f);
            }
            else
            {
                pb.CenterColor    = Lighten(_backcolor);
                pb.SurroundColors = new Color[] { _backcolor };
            }
            g.FillPath(pb, rect.GetGraphicsPath());
            if (_offImage != null && _mouseDown == false)
            {
                g.DrawImage(_offImage, Helper.RectangleHelper.Shrink(rect.ClientRect, 5));
            }
            if (_onImage != null && _mouseDown == true)
            {
                g.DrawImage(_onImage, Helper.RectangleHelper.Shrink(rect.ClientRect, 5));
            }
            _light.ClientRect = new Rectangle(rect.Left + 5, 5, rect.Width - 10, 5);
            _light.Draw(g);
            e.Graphics.DrawImage(_map, 0, 0);
        }
Ejemplo n.º 4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            RoundedRectangle rect = new RoundedRectangle(0, 0,
                                                         this.Width, this.Height, 10);

            if (_map == null)
            {
                _map = new Bitmap(this.Width, this.Height);
            }
            Graphics g = Graphics.FromImage(_map);

            rect.Shrink(5);
            Border.Border border = new Border.Border3D();
            border.DrawBorder(g, rect.GetGraphicsPath());
            g.Clip = new Region(rect.GetGraphicsPath());
            Pen p = new Pen(Color.DarkGray);
            LinearGradientBrush b = new LinearGradientBrush(rect.ClientRect, Color.WhiteSmoke, _backColor, 90f);

            g.FillPath(b, rect.GetGraphicsPath());
            g.DrawPath(p, rect.GetGraphicsPath());
            if (_backgrdImage != null)
            {
                g.DrawImage(_backgrdImage, rect.ClientRect);
            }
            rect.Shrink(10);
            _panel.Left           = rect.ClientRect.Left;
            _panel.Top            = rect.ClientRect.Top;
            _panel.Width          = rect.ClientRect.Width;
            _panel.Height         = rect.ClientRect.Height;
            _panel.Align          = _alignment;
            _panel.FlipMarking    = _flipMarking;
            _panel.MarkingStyle   = _marking;
            _panel.DisplayValue   = _displayValue;
            _panel.IndicatorColor = _indicatorColor;
            _panel.LabelFont      = _font;
            _panel.LabelFontColor = _labelFontColor;

            _panel.Draw(g);
            e.Graphics.DrawImage(_map, new Point(0, 0));
        }
Ejemplo n.º 5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            RoundedRectangle rect = new RoundedRectangle(0, 0,
                                                         this.Width, this.Height, 10);

            if (_map == null)
            {
                _map = new Bitmap(this.Width, this.Height);
            }
            Graphics g = Graphics.FromImage(_map);

            rect.Shrink(5);
            Border.Border border = new Border.Border3D();
            border.DrawBorder(g, rect.GetGraphicsPath());
            //Draw the back image
            Pen p = new Pen(Color.DarkGray);
            LinearGradientBrush b = new LinearGradientBrush(rect.ClientRect, Color.WhiteSmoke, _backColor, 90f);

            g.FillPath(b, rect.GetGraphicsPath());
            g.DrawPath(p, rect.GetGraphicsPath());
            if (_backImage != null)
            {
                g.SetClip(rect.GetGraphicsPath());
                g.DrawImage(_backImage, rect.ClientRect);
                g.ResetClip();
            }
            _panel.Left             = rect.ClientRect.Left;
            _panel.Top              = rect.ClientRect.Top;
            _panel.Width            = rect.ClientRect.Width;
            _panel.Height           = rect.ClientRect.Height;
            _panel.KnobHandleimage  = _knobHandleImage;
            _panel.MarkingType      = _markingType;
            _panel.MarkingImageType = _markingImage;
            _panel.FontColor        = _fontColor;
            _panel.MainFont         = _font;
            _panel.Draw(g);
            e.Graphics.DrawImage(_map, new Point(0, 0));
        }
Ejemplo n.º 6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            RoundedRectangle rect = new RoundedRectangle(0, 0,
                                                         this.Width, this.Height, 10);

            if (_map == null)
            {
                _map = new Bitmap(this.Width, this.Height);
            }
            if (_font == null)
            {
                _font = new Font(FontFamily.GenericMonospace, 5);
            }
            Graphics g = Graphics.FromImage(_map);

            rect.Shrink(5);
            Border.Border border = new Border.Border3D();
            border.DrawBorder(g, rect.GetGraphicsPath());
            Pen p = new Pen(Color.DarkGray);
            LinearGradientBrush b = new LinearGradientBrush(rect.ClientRect, Color.WhiteSmoke, _backcolor, 90f);

            g.FillPath(b, rect.GetGraphicsPath());
            g.DrawPath(p, rect.GetGraphicsPath());
            GraphicsState state = g.Save();

            g.SetClip(rect.GetGraphicsPath());
            //Fill in backImgae
            if (_backimage != null)
            {
                g.DrawImage(_backimage, rect.ClientRect,
                            new Rectangle(0, 0, _backimage.Width, _backimage.Height), GraphicsUnit.Pixel);
            }
            g.Restore(state);

            int i     = 0;
            int width = CalculateWidth();

            foreach (RollingCounter dispanel  in _collection)
            {
                if (_alignment == Alignment.Center)
                {
                    dispanel.Left = i * width + _edgeOffsetFromX;
                }
                else if (_alignment == Alignment.Left)
                {
                    dispanel.Left = i * width + 7;
                }
                else
                {
                    dispanel.Left = i * width + 2 * _edgeOffsetFromX - 7;
                }
                dispanel.Top    = _edgeOffsetFromY;
                dispanel.Width  = width;
                dispanel.Height = this.Height - 2 * _edgeOffsetFromY;

                dispanel.Font = _font;

                /*dispanel.FontColor = _color;
                 * dispanel.MainColor = _counterColor;*/
                dispanel.ScrollEffect = _scrollEffect;
                dispanel.Draw(g);
                i++;
            }
            g.Dispose();
            e.Graphics.DrawImage(_map, new Point(0, 0));
        }
Ejemplo n.º 7
0
        protected override void OnPaint(PaintEventArgs e)
        {
            RoundedRectangle rect = new RoundedRectangle(0, 0,
                                                         this.Width, this.Height, 10);

            if (_map == null)
            {
                _map = new Bitmap(this.Width, this.Height);
            }
            Graphics g = Graphics.FromImage(_map);

            rect.Shrink(5);
            Border.Border border = new Border.Border3D();
            border.DrawBorder(g, rect.GetGraphicsPath());
            Pen p = new Pen(Color.DarkGray);
            LinearGradientBrush b = new LinearGradientBrush(rect.ClientRect, Color.WhiteSmoke, _backgrdColor, 90f);

            g.FillPath(b, rect.GetGraphicsPath());
            g.DrawPath(p, rect.GetGraphicsPath());
            g.Clip = new Region(rect.GetGraphicsPath());
            if (_backgrdImage != null)
            {
                g.DrawImage(_backgrdImage, rect.ClientRect);
            }
            rect.Shrink(5);
            g.Clip = new Region(rect.GetGraphicsPath());
            int left = 0;

            _panelLength = rect.Width / (_numberOfPanel + 2);
            _panelHeight = rect.Height;
            if (_location == location.FILL)
            {
                _panelLength = rect.Width / (_numberOfPanel) - 1;
                int totalLength = (_numberOfPanel * _panelLength) / 2;
                if (rect.Width / 2 > totalLength)
                {
                    left = rect.Left + (rect.Width / 2 - totalLength);
                }
            }
            else if (_location == location.LEFT)
            {
                left = rect.Left + 3;
            }
            else if (_location == location.CENTER)
            {
                int totalLength = (_numberOfPanel * _panelLength) / 2;
                if (rect.Width / 2 > totalLength)
                {
                    left = rect.Left + (rect.Width / 2 - totalLength);
                }
            }
            else
            {
                left = rect.Left + rect.Width - (_numberOfPanel * _panelLength);
            }
            int i = 0;

            foreach (DigitalPanel dp in _collection)
            {
                dp.Left        = left + i * (_panelLength);
                dp.Top         = rect.Top;
                dp.Width       = _panelLength - 1;
                dp.Height      = _panelHeight;
                dp.MainColor   = _fontColor;
                dp.BackColor   = _panelColor;
                dp.EnableGlare = _enableGlare;
                dp.Draw(g);

                i++;
            }
            e.Graphics.DrawImage(_map, new Point(0, 0));
        }