Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            AreaPainter.PaintRectangle(e.Graphics, 0, 0, Width, Height, m_FillStyle, this.BackColor, this.FadeColor,
                                       this.BorderStyle, this.BorderColor);
        }
Beispiel #2
0
        /// <summary>
        /// Paint the background
        /// </summary>
        /// <param name="pevent"></param>
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            AreaPainter.PaintRectangle(pevent.Graphics, 0, 0, Width, Height, m_Style.FillStyle, m_Style.BackColor,
                                       m_Style.FadeColor, m_Style.BorderStyle, m_Style.BorderColor);

            if (m_Style.BorderStyle == BorderStyle.Raised)
            {
                ControlPaint.DrawBorder3D(pevent.Graphics, 0, 0, Width, Height, Border3DStyle.Raised);
            }
            else if (m_Style.BorderStyle == BorderStyle.Sunken)
            {
                ControlPaint.DrawBorder3D(pevent.Graphics, 0, 0, Width, Height, Border3DStyle.Sunken);
            }

            if (m_HighlightRect == Rectangle.Empty)
            {
                return;
            }

            // determine the rectangle area type
            if (m_HighlightRectType == HighlightRectType.Left)
            {
                AreaPainter.PaintRectangle(pevent.Graphics, m_HighlightRect.Left, 0, m_HighlightRect.Width - 13,
                                           Height, m_Style.FillStyleSelection, m_Style.SelectionColor, Color.White, BorderStyle.None, Color.White);
                AreaPainter.PaintRectangle(pevent.Graphics, m_HighlightRect.Right - 13, 0, 13,
                                           Height, m_Style.FillStyleSelection, Color.LightGray, Color.White, BorderStyle.None, Color.White);

                // paint the border
                Pen pen = new Pen(ColorManager.ModifyBrightness(m_Style.SelectionColor, 0.8f));
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Left, 0, m_HighlightRect.Right - 13, 0);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Left, 0, m_HighlightRect.Left, Height);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Left, Height - 1, m_HighlightRect.Right - 13, Height - 1);
                pen.Color = ColorManager.ModifyBrightness(Color.LightGray, 0.8f);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Right, 0, m_HighlightRect.Right - 13, 0);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Right, 0, m_HighlightRect.Right, Height);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Right, Height - 1, m_HighlightRect.Right - 13, Height - 1);
                pen.Dispose();
            }
            else if (m_HighlightRectType == HighlightRectType.Right)
            {
                AreaPainter.PaintRectangle(pevent.Graphics, m_HighlightRect.Left, 0, m_HighlightRect.Width - 13,
                                           Height, m_Style.FillStyleSelection, Color.LightGray, Color.White, BorderStyle.None, Color.White);
                AreaPainter.PaintRectangle(pevent.Graphics, m_HighlightRect.Right - 13, 0, 13,
                                           Height, m_Style.FillStyleSelection, m_Style.SelectionColor, Color.White, BorderStyle.None, Color.White);

                // paint the border
                Pen pen = new Pen(ColorManager.ModifyBrightness(Color.LightGray, 0.8f));
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Left, 0, m_HighlightRect.Right - 13, 0);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Left, 0, m_HighlightRect.Left, Height);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Left, Height - 1, m_HighlightRect.Right - 13, Height - 1);
                pen.Color = ColorManager.ModifyBrightness(m_Style.SelectionColor, 0.8f);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Right, 0, m_HighlightRect.Right - 13, 0);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Right, 0, m_HighlightRect.Right, Height);
                pevent.Graphics.DrawLine(pen, m_HighlightRect.Right, Height - 1, m_HighlightRect.Right - 13, Height - 1);
                pen.Dispose();
            }
            else
            {
                AreaPainter.PaintRectangle(pevent.Graphics, m_HighlightRect.Left, 0, m_HighlightRect.Width,
                                           Height, m_Style.FillStyleSelection, m_Style.SelectionColor, Color.White, BorderStyle.Solid,
                                           ColorManager.ModifyBrightness(m_Style.SelectionColor, 0.8f));
            }
        }