Exemple #1
0
        private void PaintKnob(PaintEventArgs e, Rectangle pos, int pixelPos)
        {
            SolidBrush brushRange = new SolidBrush(_colorRange);

            var rectanglePoints = new Point[] {
                pos.Location,                                     //topL
                new Point(pos.X + pos.Width, pos.Y),              //topR
                new Point(pos.X + pos.Width, pos.Y + pos.Height), //bottR
                new Point(pos.X, pos.Y + pos.Height)              //BottL
            };

            //Fill range between knobs
            e.Graphics.FillPolygon(brushRange, rectanglePoints);

            ComponentDrawer.Draw3DRectangleInverted(e, pos);

            //Draw line in the middle of Knoob
            if (_orientationBar == RangeBarOrientation.Horizontal)
            {
                ComponentDrawer.Draw3DLineInField(e, pos);
            }
            else
            {
                ComponentDrawer.Draw3DLineInField(e, pos, false);
            }
        }
Exemple #2
0
        private void DrawBarField(PaintEventArgs e)
        {
            var componEdgeToSkalaOffset = 9;

            Point backgrTopL;
            Point backgrTopR  = new Point();
            Point backgrBottL = new Point();
            Point backgrBottR;

            if (_orientationBar == RangeBarOrientation.Horizontal)
            {
                backgrTopL    = new Point(componEdgeToSkalaOffset, TopOffsetToBackField);
                backgrTopR.X  = LocalWidth - componEdgeToSkalaOffset;
                backgrBottL.Y = BottomOffsetToBackField;
            }
            else
            {
                backgrTopL    = new Point(TopOffsetToBackField, componEdgeToSkalaOffset);
                backgrTopR.X  = BottomOffsetToBackField;
                backgrBottL.Y = LocalWidth - componEdgeToSkalaOffset;
            }

            backgrTopR.Y  = backgrTopL.Y;
            backgrBottL.X = backgrTopL.X;
            backgrBottR   = new Point(backgrTopR.X, backgrBottL.Y);

            ComponentDrawer.Draw3DRectangle(e, backgrTopL, backgrTopR, backgrBottL, backgrBottR, FieldImage);
        }
Exemple #3
0
        private void ShowCurrPosValueIfNeeded(PaintEventArgs e, int tickOffset)
        {
            if (ValueShownOnKnobsMove == false)
            {
                return;
            }

            int y = 0;

            switch (ScaleOrientation)
            {
            case TopBottomOrientation.Bottom:
                y = tickOffset + _tickHeight;
                break;

            case TopBottomOrientation.Top:
                y = LocalHeight - TopOffsetToBackField + 6;
                break;

            case TopBottomOrientation.Both:
                y = LocalHeight - PixelsOffsetForNumber;
                break;
            }

            StringFormat strformat = new StringFormat();

            strformat.Alignment     = StringAlignment.Center;
            strformat.LineAlignment = StringAlignment.Near;

            if (_lKnobMoveGoing)
            {
                if (_orientationBar == RangeBarOrientation.Horizontal)
                {
                    ComponentDrawer.DrawString(e, _rangeMin.ToString(), _knobWidth, _pixelPosL, y, strformat);
                }
                else
                {
                    strformat.Alignment     = StringAlignment.Near;
                    strformat.LineAlignment = StringAlignment.Center;

                    ComponentDrawer.DrawString(e, _rangeMin.ToString(), _knobWidth, y + 2, _pixelPosL, strformat);
                }
            }

            if (_rKnobIsMoving)
            {
                if (_orientationBar == RangeBarOrientation.Horizontal)
                {
                    ComponentDrawer.DrawString(e, _rangeMax.ToString(), _knobWidth, _pixelPosR, y, strformat);
                }
                else
                {
                    strformat.Alignment     = StringAlignment.Near;
                    strformat.LineAlignment = StringAlignment.Center;

                    ComponentDrawer.DrawString(e, _rangeMax.ToString(), _knobWidth, y, _pixelPosR, strformat);
                }
            }
        }
Exemple #4
0
        private void DrawSkala(PaintEventArgs e)
        {
            int skalaTopOffset, skalaBottomOffset;//Y for horiz; X for vert;

            CalcSkalaTopAndBottom(out skalaTopOffset, out skalaBottomOffset);

            Rectangle rectTopOrLeft   = new Rectangle();
            Rectangle rectBottOrRight = new Rectangle();

            if (_orientationBar == RangeBarOrientation.Horizontal)
            {
                if (_orientationScale == TopBottomOrientation.Top || _orientationScale == TopBottomOrientation.Both)
                {
                    rectTopOrLeft = new Rectangle(9, skalaTopOffset, Width - 18, _tickHeight);
                    ComponentDrawer.DrawSkala(e, rectTopOrLeft, _numAxisDivision, false);
                }

                if (_orientationScale == TopBottomOrientation.Bottom || _orientationScale == TopBottomOrientation.Both)
                {
                    rectBottOrRight = new Rectangle(9, skalaBottomOffset, Width - 18, _tickHeight);
                    ComponentDrawer.DrawSkala(e, rectBottOrRight, _numAxisDivision, false);
                }
            }
            else  // Vertical bar
            {
                if (_orientationScale == TopBottomOrientation.Top || _orientationScale == TopBottomOrientation.Both)
                {
                    rectTopOrLeft = new Rectangle(skalaTopOffset, 9, _tickHeight, Height - 18);
                    ComponentDrawer.DrawSkala(e, rectTopOrLeft, _numAxisDivision);
                }

                if (_orientationScale == TopBottomOrientation.Bottom || _orientationScale == TopBottomOrientation.Both)
                {
                    rectBottOrRight = new Rectangle(skalaBottomOffset, 9, _tickHeight, Height - 18);
                    ComponentDrawer.DrawSkala(e, rectBottOrRight, _numAxisDivision);
                }
            }

            ShowCurrPosValueIfNeeded(e, skalaTopOffset);
        }
Exemple #5
0
        private void DrawSelectedRegion(PaintEventArgs e)
        {
            Rectangle rect = new Rectangle();

            if (_orientationBar == RangeBarOrientation.Horizontal)
            {
                rect = new Rectangle(_pixelPosL, TopOffsetToBackField + 1,
                                     _pixelPosR - _pixelPosL + 1, BottomOffsetToBackField - TopOffsetToBackField - 1);
            }
            else
            {
                rect = new Rectangle(TopOffsetToBackField + 1, _pixelPosL, Width - TopOffsetToBackField * 2 - 1,
                                     _pixelPosR - _pixelPosL + 1);
            }

            if (Enabled)
            {
                ComponentDrawer.DrawFilledRect(e, rect, _colorInner);
            }
            else
            {
                ComponentDrawer.DrawFilledRect(e, rect, Color.FromKnownColor(KnownColor.InactiveCaption));
            }
        }