Exemplo n.º 1
0
        internal void DrawBorder(Graphics gr, Color color, Size size, RescoBorderStyle borderStyle)
        {
            int x = (int)(this.m_scaleFactor.Width / 2f);
            int y = (int)(this.m_scaleFactor.Height / 2f);

            if (borderStyle != RescoBorderStyle.None)
            {
                if ((borderStyle & RescoBorderStyle.All) != RescoBorderStyle.None)
                {
                    gr.DrawRectangle(this.GetPen(color), x, y, (size.Width - 1) - (2 * x), (size.Height - 1) - (2 * y));
                }
                else
                {
                    if ((borderStyle & RescoBorderStyle.Left) != RescoBorderStyle.None)
                    {
                        gr.DrawLine(this.GetPen(color), x, 0, x, size.Height);
                    }
                    if ((borderStyle & RescoBorderStyle.Right) != RescoBorderStyle.None)
                    {
                        gr.DrawLine(this.GetPen(color), size.Width - 1, 0, size.Width - 1, size.Height);
                    }
                    if ((borderStyle & RescoBorderStyle.Top) != RescoBorderStyle.None)
                    {
                        gr.DrawLine(this.GetPen(color), 0, y, size.Width, y);
                    }
                    if ((borderStyle & RescoBorderStyle.Bottom) != RescoBorderStyle.None)
                    {
                        gr.DrawLine(this.GetPen(color), 0, size.Height - 1, size.Width, size.Height - 1);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void PositionControls()
        {
            int       num;
            Rectangle rectangle;
            Rectangle rectangle2;
            Rectangle rectangle3;
            Size      clientSize = base.ClientSize;
            SizeF     ef         = new SizeF((float)clientSize.Width, (float)clientSize.Height);

            using (Graphics graphics = base.CreateGraphics())
            {
                ef = graphics.MeasureString((this.m_textBox.Text != "") ? this.m_textBox.Text : "0", this.m_textBox.Font);
            }
            bool flag = true;

            switch (this.m_upDownAlign)
            {
            case UpDownAlignment.Left:
                rectangle  = new Rectangle((2 * this.UpDownWidth) + this.ConstTextBoxBorder, (clientSize.Height - ((int)ef.Height)) / 2, (clientSize.Width - (2 * this.UpDownWidth)) - (2 * this.ConstTextBoxBorder), (int)ef.Height);
                rectangle2 = new Rectangle(0, 0, this.UpDownWidth, clientSize.Height);
                rectangle3 = new Rectangle(this.UpDownWidth, 0, this.UpDownWidth, clientSize.Height);
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.BorderStyle = RescoBorderStyle.Right;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.BorderStyle = RescoBorderStyle.Right;
                }
                break;

            case UpDownAlignment.HorizontalSplit:
                rectangle  = new Rectangle(this.UpDownWidth + this.ConstTextBoxBorder, (clientSize.Height - ((int)ef.Height)) / 2, (clientSize.Width - (2 * this.UpDownWidth)) - (2 * this.ConstTextBoxBorder), (int)ef.Height);
                rectangle2 = new Rectangle(0, 0, this.UpDownWidth, clientSize.Height);
                rectangle3 = new Rectangle(clientSize.Width - this.UpDownWidth, 0, this.UpDownWidth, clientSize.Height);
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.BorderStyle = RescoBorderStyle.Right;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.BorderStyle = RescoBorderStyle.Left;
                }
                break;

            case UpDownAlignment.Up:
                num        = ((clientSize.Height - this.UpDownWidth) - ((int)ef.Height)) / 2;
                rectangle  = new Rectangle(this.ConstTextBoxBorder, this.UpDownWidth + ((num > 0) ? num : 0), clientSize.Width - (2 * this.ConstTextBoxBorder), (int)ef.Height);
                rectangle2 = new Rectangle(0, 0, clientSize.Width / 2, this.UpDownWidth);
                rectangle3 = new Rectangle(clientSize.Width / 2, 0, clientSize.Width / 2, this.UpDownWidth);
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.BorderStyle = RescoBorderStyle.Bottom | RescoBorderStyle.Right;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.BorderStyle = RescoBorderStyle.Bottom;
                }
                break;

            case UpDownAlignment.Down:
                num        = ((clientSize.Height - this.UpDownWidth) - ((int)ef.Height)) / 2;
                rectangle  = new Rectangle(this.ConstTextBoxBorder, (num > 0) ? num : (2 * num), clientSize.Width - (2 * this.ConstTextBoxBorder), (int)ef.Height);
                rectangle2 = new Rectangle(0, clientSize.Height - this.UpDownWidth, clientSize.Width / 2, this.UpDownWidth);
                rectangle3 = new Rectangle(clientSize.Width / 2, clientSize.Height - this.UpDownWidth, clientSize.Width / 2, this.UpDownWidth);
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.BorderStyle = RescoBorderStyle.Top | RescoBorderStyle.Right;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.BorderStyle = RescoBorderStyle.Top;
                }
                break;

            case UpDownAlignment.VerticalSplit:
                rectangle  = new Rectangle(this.ConstTextBoxBorder, (clientSize.Height - ((int)ef.Height)) / 2, clientSize.Width - (2 * this.ConstTextBoxBorder), (int)ef.Height);
                rectangle2 = new Rectangle(0, 0, clientSize.Width, this.UpDownWidth);
                rectangle3 = new Rectangle(0, clientSize.Height - this.UpDownWidth, clientSize.Width, this.UpDownWidth);
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.BorderStyle = RescoBorderStyle.Bottom;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.BorderStyle = RescoBorderStyle.Top;
                }
                break;

            case UpDownAlignment.None:
                rectangle  = new Rectangle(this.ConstTextBoxBorder, (clientSize.Height - ((int)ef.Height)) / 2, clientSize.Width - (2 * this.ConstTextBoxBorder), (int)ef.Height);
                rectangle2 = new Rectangle(0, 0, 1, 1);
                rectangle3 = new Rectangle(0, 0, 1, 1);
                flag       = false;
                break;

            default:
                rectangle  = new Rectangle(this.ConstTextBoxBorder, (clientSize.Height - ((int)ef.Height)) / 2, (clientSize.Width - (2 * this.UpDownWidth)) - (2 * this.ConstTextBoxBorder), (int)ef.Height);
                rectangle2 = new Rectangle(clientSize.Width - (2 * this.UpDownWidth), 0, this.UpDownWidth, clientSize.Height);
                rectangle3 = new Rectangle(clientSize.Width - this.UpDownWidth, 0, this.UpDownWidth, clientSize.Height);
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.BorderStyle = RescoBorderStyle.Left;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.BorderStyle = RescoBorderStyle.Left;
                }
                break;
            }
            if (this.m_plusButton != null)
            {
                this.m_plusButton.Visible = flag;
            }
            if (this.m_minusButton != null)
            {
                this.m_minusButton.Visible = flag;
            }
            if (this.m_textBox != null)
            {
                this.m_textBox.Bounds = rectangle;
            }
            if (this.m_upDownStyle == Resco.Controls.NumericUpDown.UpDownStyle.UpDown)
            {
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.Bounds = rectangle2;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.Bounds = rectangle3;
                }
            }
            else
            {
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.Bounds = rectangle3;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.Bounds = rectangle2;
                }
                RescoBorderStyle borderStyle = this.m_plusButton.BorderStyle;
                if (this.m_plusButton != null)
                {
                    this.m_plusButton.BorderStyle = this.m_minusButton.BorderStyle;
                }
                if (this.m_minusButton != null)
                {
                    this.m_minusButton.BorderStyle = borderStyle;
                }
            }
            base.Invalidate();
        }
Exemplo n.º 3
0
        internal void DrawAdornment(Graphics gr, int x, int y, int size, Color color, AdornmentType adornmentType, RescoBorderStyle borderStyle)
        {
            Point[] points = new Point[3];
            switch (borderStyle)
            {
            case RescoBorderStyle.None:
            case RescoBorderStyle.All:
                break;

            case RescoBorderStyle.Right:
                x--;
                break;

            default:
                x++;
                break;
            }
            switch (adornmentType)
            {
            case AdornmentType.RightArrow:
                x        -= size / 2;
                points[0] = new Point(x, y + size);
                points[1] = new Point(x + size, y);
                points[2] = new Point(x, y - size);
                gr.FillPolygon(this.GetBrush(color), points);
                return;

            case AdornmentType.UpArrow:
                y        += size / 2;
                points[0] = new Point((x + size) + 1, y);
                points[1] = new Point(x, (y - size) - 1);
                points[2] = new Point(x - size, y);
                gr.FillPolygon(this.GetBrush(color), points);
                return;

            case AdornmentType.LeftArrow:
                x        += size / 2;
                points[0] = new Point(x, y - size);
                points[1] = new Point(x - size, y);
                points[2] = new Point(x, y + size);
                gr.FillPolygon(this.GetBrush(color), points);
                return;

            case AdornmentType.DownArrow:
                y        -= size / 2;
                points[0] = new Point((x - size) + 1, y);
                points[1] = new Point(x, y + size);
                points[2] = new Point(x + size, y);
                gr.FillPolygon(this.GetBrush(color), points);
                return;

            case AdornmentType.Plus:
            case AdornmentType.Minus:
            {
                int height = size / 4;
                size += (size - height) % 2;
                int num2 = x - (size / 2);
                int num3 = y - (size / 2);
                gr.FillRectangle(this.GetBrush(color), num2, y - (height / 2), size, height);
                if (adornmentType == AdornmentType.Plus)
                {
                    gr.FillRectangle(this.GetBrush(color), x - (height / 2), num3, height, size);
                }
                break;
            }

            case AdornmentType.Text:
            case AdornmentType.None:
                break;

            default:
                return;
            }
        }
Exemplo n.º 4
0
        internal void DrawAdornment(Graphics gr, int x, int y, int size, Color color, AdornmentType adornmentType, RescoBorderStyle borderStyle)
        {
            Point[] points = new Point[3];
            switch (borderStyle)
            {
                case RescoBorderStyle.None:
                case RescoBorderStyle.All:
                    break;

                case RescoBorderStyle.Right:
                    x--;
                    break;

                default:
                    x++;
                    break;
            }
            switch (adornmentType)
            {
                case AdornmentType.RightArrow:
                    x -= size / 2;
                    points[0] = new Point(x, y + size);
                    points[1] = new Point(x + size, y);
                    points[2] = new Point(x, y - size);
                    gr.FillPolygon(this.GetBrush(color), points);
                    return;

                case AdornmentType.UpArrow:
                    y += size / 2;
                    points[0] = new Point((x + size) + 1, y);
                    points[1] = new Point(x, (y - size) - 1);
                    points[2] = new Point(x - size, y);
                    gr.FillPolygon(this.GetBrush(color), points);
                    return;

                case AdornmentType.LeftArrow:
                    x += size / 2;
                    points[0] = new Point(x, y - size);
                    points[1] = new Point(x - size, y);
                    points[2] = new Point(x, y + size);
                    gr.FillPolygon(this.GetBrush(color), points);
                    return;

                case AdornmentType.DownArrow:
                    y -= size / 2;
                    points[0] = new Point((x - size) + 1, y);
                    points[1] = new Point(x, y + size);
                    points[2] = new Point(x + size, y);
                    gr.FillPolygon(this.GetBrush(color), points);
                    return;

                case AdornmentType.Plus:
                case AdornmentType.Minus:
                {
                    int height = size / 4;
                    size += (size - height) % 2;
                    int num2 = x - (size / 2);
                    int num3 = y - (size / 2);
                    gr.FillRectangle(this.GetBrush(color), num2, y - (height / 2), size, height);
                    if (adornmentType == AdornmentType.Plus)
                    {
                        gr.FillRectangle(this.GetBrush(color), x - (height / 2), num3, height, size);
                    }
                    break;
                }
                case AdornmentType.Text:
                case AdornmentType.None:
                    break;

                default:
                    return;
            }
        }
Exemplo n.º 5
0
 internal void DrawBorder(Graphics gr, Color color, Size size, RescoBorderStyle borderStyle)
 {
     int x = (int) (this.m_scaleFactor.Width / 2f);
     int y = (int) (this.m_scaleFactor.Height / 2f);
     if (borderStyle != RescoBorderStyle.None)
     {
         if ((borderStyle & RescoBorderStyle.All) != RescoBorderStyle.None)
         {
             gr.DrawRectangle(this.GetPen(color), x, y, (size.Width - 1) - (2 * x), (size.Height - 1) - (2 * y));
         }
         else
         {
             if ((borderStyle & RescoBorderStyle.Left) != RescoBorderStyle.None)
             {
                 gr.DrawLine(this.GetPen(color), x, 0, x, size.Height);
             }
             if ((borderStyle & RescoBorderStyle.Right) != RescoBorderStyle.None)
             {
                 gr.DrawLine(this.GetPen(color), size.Width - 1, 0, size.Width - 1, size.Height);
             }
             if ((borderStyle & RescoBorderStyle.Top) != RescoBorderStyle.None)
             {
                 gr.DrawLine(this.GetPen(color), 0, y, size.Width, y);
             }
             if ((borderStyle & RescoBorderStyle.Bottom) != RescoBorderStyle.None)
             {
                 gr.DrawLine(this.GetPen(color), 0, size.Height - 1, size.Width, size.Height - 1);
             }
         }
     }
 }