Esempio n. 1
0
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            base.OnPaintBackground(pevent);
            SolidBrush br = new SolidBrush(Color.Transparent);

            pevent.Graphics.FillPath(br, Rounder.GetRoundedBounds(this.ClientRectangle, Corners.None));
        }
Esempio n. 2
0
        private void MakeSideBanner(Rectangle bounds, PaintEventArgs e)
        {
            GraphicsPath path = Rounder.GetRoundedBounds(bounds, Corners.All);
            Graphics     g    = e.Graphics;
            Pen          pen  = new Pen(new SolidBrush(Color.White));

            g.SmoothingMode = SmoothingMode.HighQuality;
            Bitmap image = new Bitmap(Resources.logo, bounds.Size);

            g.DrawImage((Image)image, bounds);

            pen = new Pen(new SolidBrush(Color.Red));
            g.DrawRectangle(pen, bounds);
        }
Esempio n. 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics g = e.Graphics;

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            Rectangle titlebox = this.TitleBox;

            int halfheight = titlebox.Height / 2;

            Rectangle rect = new Rectangle(this.ClientRectangle.Left,
                                           this.ClientRectangle.Top + halfheight, this.ClientRectangle.Right - 1,
                                           this.ClientRectangle.Height - (halfheight + 1));

            GraphicsPath path = Rounder.GetRoundedBounds(rect, BoxCorners);

            titlebox.Location = new Point(rect.Left + 15, rect.Top - titlebox.Height / 2);
            GraphicsPath titlepath = Rounder.GetRoundedBounds(titlebox, TitleCorners);

            StringFormat sf = new StringFormat();

            sf.LineAlignment = StringAlignment.Near;
            sf.Trimming      = StringTrimming.EllipsisCharacter;
            sf.Alignment     = StringAlignment.Near;

            Pen borderPen = new Pen(Color.Black);
            LinearGradientBrush patternBrush = new LinearGradientBrush(rect, upperColor, bottomColor,
                                                                       LinearGradientMode.Vertical);

            LinearGradientBrush titleBrush = new LinearGradientBrush(titlebox, upperColor, bottomColor,
                                                                     LinearGradientMode.Vertical);

            //paint
            g.FillPath(patternBrush, path);
            g.DrawPath(borderPen, path);



            g.FillPath(titleBrush, titlepath);
            g.DrawPath(borderPen, titlepath);

            g.DrawString(this.title, this.Font, SystemBrushes.ControlText, titlebox.Location, sf);

            //destroy
            patternBrush.Dispose();
            borderPen.Dispose();
            g.Dispose();
        }
Esempio n. 4
0
 void maintableLayoutPanel_Paint(object sender, PaintEventArgs e)
 {
     base.OnPaint(e);
     if (!DesignMode)
     {
         System.Drawing.Drawing2D.LinearGradientBrush br = new System.Drawing.Drawing2D.LinearGradientBrush(
             e.ClipRectangle,
             SystemColors.ControlDark,
             SystemColors.Control,
             LinearGradientMode.Horizontal);
         e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
         e.Graphics.FillPath(br, Rounder.GetRoundedBounds(e.ClipRectangle, Corners.None));
         br.Dispose();
     }
 }
Esempio n. 5
0
        //void parent_Paint(object sender, PaintEventArgs e)
        //{
        //    if (!DesignMode)
        //    {
        //        Graphics g = e.Graphics;
        //        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

        //        LinearGradientBrush brush = new LinearGradientBrush(e.ClipRectangle, SystemColors.ControlDarkDark,
        //            SystemColors.ControlDark, LinearGradientMode.Vertical);

        //        g.FillRectangle(brush, e.ClipRectangle);
        //    }
        //}

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (!DesignMode)
            {
                Graphics g = e.Graphics;
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                GraphicsPath path = Rounder.GetRoundedBounds(this.Bounds, Corners.BottomLeft | Corners.TopLeft);

                LinearGradientBrush brush = new LinearGradientBrush(this.Bounds, SystemColors.ControlDark,
                                                                    Color.White, LinearGradientMode.Horizontal);

                //LinearGradientBrush brush = new LinearGradientBrush(this.Bounds, Color.FromArgb(0, 191, 255),
                //    Color.LightBlue, LinearGradientMode.Horizontal);

                Pen pen = new Pen(new SolidBrush(Color.White));

                g.DrawPath(pen, path);
                g.FillPath(brush, path);

                pen.Dispose();
                brush.Dispose();

                //int vOffset = this.Bounds.Bottom * 1 / 8;
                int vOffset = 80;
                int hOffset = this.Bounds.Right * 1 / 10;
                int width   = this.Bounds.Right * 4 / 5;
                int length  = this.Bounds.Bottom * 1 / 7;

                Rectangle bannerBounds  = new Rectangle(hOffset, 10, width, 40);
                Rectangle displayBounds = new Rectangle(hOffset, vOffset, width, 70);
                //Rectangle filterBounds = new Rectangle(hOffset, 30 + displayBounds.Bottom, width, 2 * (length - 15));
                Rectangle filterBounds = new Rectangle(hOffset, 30 + displayBounds.Bottom, width, 60);

                MakeSideBanner(bannerBounds, e);
                if (Connector.Connected)
                {
                    MakeSideDisplayPanel(displayBounds, e);
                    MakeSideFilterPanel(filterBounds, e);
                }
                else
                {
                    this.textBox.Visible = false;
                }
                this.textBox.Invalidate();
            }
        }
Esempio n. 6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (!this.DesignMode)
            {
                Rectangle bounds = this.Bounds;

                Graphics            g     = e.Graphics;
                Pen                 pen   = new Pen(new SolidBrush(this.borderColor));
                LinearGradientBrush brush = new LinearGradientBrush(this.Bounds,
                                                                    SystemColors.ControlLight, SystemColors.ControlDark, LinearGradientMode.Vertical);

                int          bannerOffset = 20;
                StringFormat sf           = new StringFormat();
                sf.Alignment     = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Center;

                Rectangle banner     = new Rectangle(bounds.Location, new Size(bounds.Width - 5, bannerOffset));
                Rectangle bannerText = new Rectangle(bounds.X + 5, bounds.Y + 5, banner.Width, bannerOffset - 5);

                Rectangle body = new Rectangle(new Point(banner.Left, banner.Bottom),
                                               new Size(bounds.Width - 5, bounds.Bottom - banner.Bottom));

                Point atPoint = new Point(bannerText.Width / 2, bannerText.Bottom * 2 / 3);

                GraphicsPath path  = Rounder.GetRoundedBounds(banner, Corners.None);
                GraphicsPath path2 = Rounder.GetRoundedBounds(body, Corners.None);

                //path.AddPath(path2, true);

                g.FillPath(brush, path);
                g.DrawPath(pen, path);

                g.DrawString(header, this.Font, new SolidBrush(this.fontColor), atPoint, sf);
                g.Dispose();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Make the filter panel on the left hand side
        /// </summary>
        /// <param name="bounds"></param>
        /// <param name="e"></param>
        private void MakeSideFilterPanel(Rectangle bounds, PaintEventArgs e)
        {
            GraphicsPath path = new GraphicsPath();

            Graphics            g     = e.Graphics;
            Pen                 pen   = new Pen(new SolidBrush(Color.Black));
            LinearGradientBrush brush = new LinearGradientBrush(this.Bounds,
                                                                SystemColors.ControlLightLight, SystemColors.ControlLight, LinearGradientMode.Vertical);

            int bannerOffset = 20;
            int hstart       = bounds.Left + bounds.Width / 8;
            int width        = bounds.Width / 12;
            int shiftlength  = 10;
            int itemsize     = width + 17;
            int vstart       = bounds.Top + 20 + width;

            if (viewer.Columns.Count > 0)
            {
                bounds.Height = bounds.Height + ((viewer.Columns.Count - 1) * (itemsize));
            }
            path = Rounder.GetRoundedBounds(bounds, Corners.All);

            path.StartFigure();
            path.AddLine(bounds.Left, bounds.Top + bannerOffset, bounds.Right, bounds.Top + bannerOffset);
            path.CloseFigure();

            Font smallFont = new Font(FontFamily.GenericSerif, 9, FontStyle.Bold);

            /*
             * Point vFilter = new Point(bounds.Left, vstart + width / 2);
             * Rectangle vFilterBounds = new Rectangle(hstart + 25, vstart - 5, bounds.Width * 2/3, 2 * width);
             *
             * vstart += width + shiftlength;
             *
             * Point vBy = new Point(bounds.Left, vstart + width + 5);
             * Rectangle vByBounds = new Rectangle(hstart + 10, vstart, bounds.Width * 2/3, 2 * width);
             */

            StringFormat sf = new StringFormat();

            sf.Alignment     = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;

            Rectangle banner = new Rectangle(bounds.Location, new Size(bounds.Width - 5, bannerOffset));

            Point atPoint = new Point(banner.Width * 2 / 3, banner.Bottom - 10);

            g.FillPath(brush, path);
            g.DrawPath(pen, path);

            g.DrawString("Filters", this.Font, new SolidBrush(this.ForeColor), atPoint, sf);

            sf.Alignment = StringAlignment.Near;
            filterPoints.Clear();

            if (viewer.Columns.Count > 0)
            {
                if (currentFilter == string.Empty)
                {
                    this.currentFilter = viewer.Columns[0];
                }
                foreach (string name in viewer.Columns)
                {
                    Point[] square = new Point[] {
                        new Point(hstart, vstart),
                        new Point(hstart + width, vstart),
                        new Point(hstart + width, vstart + width),
                        new Point(hstart, vstart + width)
                    };
                    GraphicsPath squarePath = new GraphicsPath();

                    Point     vName         = new Point(hstart + (2 * width), vstart + width / 2);
                    Rectangle vsquareBounds = new Rectangle(hstart - 2, vstart - width, bounds.Right - hstart, 2 * width);

                    path.StartFigure();
                    squarePath.AddLines(square);
                    path.CloseFigure();

                    g.FillPath(new LinearGradientBrush(square[0], square[1], SystemColors.ControlLight,
                                                       SystemColors.ControlLightLight), squarePath);

                    if (name == currentFilter)
                    {
                        g.FillPath(new LinearGradientBrush(square[0], square[1], Color.Red,
                                                           Color.Blue), squarePath);
                    }

                    g.DrawPath(pen, squarePath);
                    g.DrawString(name, smallFont, new SolidBrush(Color.Black), vName, sf);

                    filterPoints.Add(vsquareBounds, new ControlDefinition(typeof(LinkArea), name, null));

                    vstart += width + shiftlength;
                }
            }

            //vstart += width + shiftlength;

            Rectangle tBoxBounds = new Rectangle(hstart - 2, vstart, bounds.Right - hstart - 20, 30);
            Rectangle cBounds    = new Rectangle(hstart + tBoxBounds.Width, vstart, 16, 20);

            this.textBox.Bounds  = tBoxBounds;
            this.textBox.Visible = true;

            Bitmap bitmap = new Bitmap(Resources.redx, cBounds.Size);

            g.DrawImage((Image)bitmap, cBounds);

            this.cursorPoints.Add(cBounds, clearFilterControl);

            /*
             * sf.Alignment = StringAlignment.Near;
             * g.DrawString("Filter:", smallFont, new SolidBrush(Color.Black), vFilter, sf);
             *
             * sf.LineAlignment = StringAlignment.Far;
             * g.DrawString("By:", smallFont, new SolidBrush(Color.Black), vBy, sf);
             *
             * this.comboBox.Bounds = vFilterBounds;
             * this.comboBox.Visible = true;
             * this.textBox.Bounds = vByBounds;
             * this.textBox.Visible = true;
             */
        }
Esempio n. 8
0
        private void MakeSideDisplayPanel(Rectangle bounds, PaintEventArgs e)
        {
            GraphicsPath        path  = Rounder.GetRoundedBounds(bounds, Corners.All);
            Graphics            g     = e.Graphics;
            Pen                 pen   = new Pen(new SolidBrush(Color.White));
            LinearGradientBrush brush = new LinearGradientBrush(this.Bounds,
                                                                SystemColors.ControlLight, SystemColors.ControlDark, LinearGradientMode.Vertical);

            int bannerOffset = 20;
            int hstart       = bounds.Left + bounds.Width / 8;
            int width        = bounds.Width / 12;
            int shiftlength  = 12;
            int vstart       = bounds.Top + 20 + bounds.Height * 1 / 8;

            Font smallFont = new Font(FontFamily.GenericSerif, 9, FontStyle.Bold);

            Point[] square1 = new Point[] {
                new Point(hstart, vstart),
                new Point(hstart + width, vstart),
                new Point(hstart + width, vstart + width),
                new Point(hstart, vstart + width)
            };

            //Point vEvents = new Point((bounds.Right + hstart + 5) / 2, vstart + width / 2 );
            Point     vEvents      = new Point(hstart + (2 * width), vstart + width / 2);
            Rectangle vEventBounds = new Rectangle(hstart - 2, vstart - width, bounds.Width - hstart, 2 * width);

            vstart += width + shiftlength;

            Point[] square2 = new Point[] {
                new Point(hstart, vstart),
                new Point(hstart + width, vstart),
                new Point(hstart + width, vstart + width),
                new Point(hstart, vstart + width)
            };

            //Point vErrors = new Point((bounds.Right + hstart + 5) / 2, vstart + width / 2);
            Point     vErrors      = new Point(hstart + (2 * width), vstart + width / 2);
            Rectangle vErrorBounds = new Rectangle(hstart - 2, vstart - width, bounds.Width - hstart, 2 * width);

            GraphicsPath square1Path = new GraphicsPath();
            GraphicsPath square2Path = new GraphicsPath();

            path.StartFigure();
            path.AddLine(bounds.Left, bounds.Top + bannerOffset, bounds.Right, bounds.Top + bannerOffset);
            path.CloseFigure();

            square1Path.StartFigure();
            square1Path.AddLines(square1);
            square2Path.CloseFigure();

            square2Path.StartFigure();
            square2Path.AddLines(square2);
            square2Path.CloseFigure();

            cursorPoints.Clear();
            cursorPoints.Add(vEventBounds, vEventsControl);
            cursorPoints.Add(vErrorBounds, vErrorControl);

            StringFormat sf = new StringFormat();

            sf.Alignment     = StringAlignment.Center;
            sf.LineAlignment = StringAlignment.Center;

            Rectangle banner  = new Rectangle(bounds.Location, new Size(bounds.Width - 5, bannerOffset));
            Point     atPoint = new Point(banner.Width * 2 / 3, banner.Bottom - 10);

            g.FillPath(brush, path);
            g.DrawPath(pen, path);

            //g.DrawString("Display", this.Font, new SolidBrush(Color.White), atPoint, sf);

            g.FillPath(new LinearGradientBrush(square1[0], square1[1], SystemColors.ControlLight,
                                               SystemColors.ControlLightLight), square1Path);

            g.DrawString("Display", this.Font, new SolidBrush(Color.Black), atPoint, sf);

            g.FillPath(new LinearGradientBrush(square2[0], square2[1], SystemColors.ControlLight,
                                               SystemColors.ControlLightLight), square2Path);

            if (viewEvents)
            {
                g.FillPath(new LinearGradientBrush(square1[0], square1[1], Color.Red,
                                                   Color.Blue), square1Path);
            }
            else
            {
                g.FillPath(new LinearGradientBrush(square2[0], square2[1], Color.Red,
                                                   Color.Blue), square2Path);
            }

            sf.Alignment = StringAlignment.Near;
            g.DrawPath(pen, square1Path);
            g.DrawString("View Events", smallFont, new SolidBrush(Color.Black), vEvents, sf);

            g.DrawPath(pen, square2Path);
            g.DrawString("View Errors", smallFont, new SolidBrush(Color.Black), vErrors, sf);
        }
Esempio n. 9
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            if (!DesignMode)
            {
                Graphics g = e.Graphics;
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

                LinearGradientBrush brush = new LinearGradientBrush(this.SplitterRectangle, Color.White,
                                                                    SystemColors.Control, LinearGradientMode.Horizontal);

                //LinearGradientBrush brush = new LinearGradientBrush(this.SplitterRectangle, Color.FromArgb(135,206,250),
                //    Color.FromArgb(224, 255, 255), LinearGradientMode.Horizontal);

                Pen borderpen = new Pen(new SolidBrush(Color.White));

                Pen pen = new Pen(new SolidBrush(Color.OrangeRed));

                GraphicsPath path = Rounder.GetRoundedBounds(this.SplitterRectangle, Corners.All);

                g.FillPath(brush, path);

                g.DrawLine(borderpen, new Point(SplitterRectangle.Left, SplitterRectangle.Top),
                           new Point(SplitterRectangle.Right, SplitterRectangle.Top));
                g.DrawLine(borderpen, new Point(SplitterRectangle.Right, SplitterRectangle.Top),
                           new Point(SplitterRectangle.Right, SplitterRectangle.Bottom));
                g.DrawLine(borderpen, new Point(SplitterRectangle.Right, SplitterRectangle.Bottom),
                           new Point(SplitterRectangle.Left, SplitterRectangle.Bottom));

                if (this.EnteredFocus)
                {
                    Rectangle bounds      = this.SplitterRectangle;
                    int       athird      = bounds.Height / 3;
                    int       shiftlength = bounds.Width * 2 / 5;
                    int       twothird    = bounds.Height * 2 / 3;
                    int       mid         = (athird + twothird) / 2;

                    Point[] expandtriangle = new Point[] {
                        new Point(bounds.Right - (shiftlength), mid),
                        new Point(bounds.Right - (2 * shiftlength), mid - 5),
                        new Point(bounds.Right - (2 * shiftlength), mid + 5)
                    };

                    Point[] collapsetriangle = new Point[] {
                        new Point(bounds.Right - (2 * shiftlength), mid),
                        new Point(bounds.Right - (shiftlength), mid - 5),
                        new Point(bounds.Right - (shiftlength), mid + 5)
                    };

                    GraphicsPath p = new GraphicsPath();

                    p.StartFigure();

                    if (this.SplitterDistance == 0)
                    {
                        p.AddLines(expandtriangle);
                    }
                    else
                    {
                        p.AddLines(collapsetriangle);
                    }
                    p.CloseFigure();
                    g.FillPath(pen.Brush, p);
                    p.Reset();

                    p = this.GetCollapseLine(this.SplitterRectangle);

                    g.DrawPath(pen, p);
                }

                pen.Dispose();
                brush.Dispose();
            }
        }
Esempio n. 10
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, this.BackColor,
                                                                Color.White, LinearGradientMode.Horizontal);
            SolidBrush barBrush  = new SolidBrush(this.barcolor);
            SolidBrush textBrush = new SolidBrush(this.textcolor);
            Graphics   g         = e.Graphics;

            g.SmoothingMode = SmoothingMode.HighSpeed;

            GraphicsPath path = Rounder.GetRoundedBounds(this.ClientRectangle, Corners.None);

            e.Graphics.FillPath(brush, path);

            //if (!DesignMode)
            {
                StringFormat sf = new StringFormat();
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment     = StringAlignment.Center;
                sf.Trimming      = StringTrimming.EllipsisCharacter;
                System.Drawing.Font font = new Font(FontFamily.GenericSerif, 8f, FontStyle.Bold);

                if (this.Style == ProgressBarStyle.Continuous)
                {
                    float     percent = (float)(base.Value - base.Minimum) / (float)(base.Maximum - base.Minimum);
                    Rectangle rect    = this.ClientRectangle;

                    // Calculate area for drawing the progress.
                    rect.Width = (int)((float)rect.Width * percent);

                    GraphicsPath barPath = Rounder.GetRoundedBounds(rect, Corners.All);
                    // Draw the progress meter.
                    g.FillPath(barBrush, barPath);
                }
                else if (this.Style == ProgressBarStyle.Marquee)
                {
                    Rectangle rect = new Rectangle(new Point(barlocation, this.ClientRectangle.Top),
                                                   new Size(barlength, this.ClientRectangle.Height));

                    GraphicsPath barPath = Rounder.GetRoundedBounds(rect, Corners.None);

                    LinearGradientBrush barBrush2 = new LinearGradientBrush(rect, this.barcolor, Color.Yellow,
                                                                            (direction == Direction.Forward) ? LinearGradientMode.ForwardDiagonal : LinearGradientMode.BackwardDiagonal);

                    g.FillPath(barBrush2, barPath);
                }
                else
                {
                    float     percent = (float)(base.Value - base.Minimum) / (float)(base.Maximum - base.Minimum);
                    Rectangle rect    = this.ClientRectangle;

                    // Calculate area for drawing the progress.
                    rect.Width = (int)((float)rect.Width * percent);

                    int remainder = 0;
                    int numBlocks = Math.DivRem(rect.Width, blocksize, out remainder);
                    int left = rect.Left, top = rect.Top, height = rect.Height;

                    for (int i = 0; i < numBlocks; i++)
                    {
                        Rectangle block = new Rectangle(left, top, blocksize, height);
                        left += blocksize;

                        GraphicsPath barPath = Rounder.GetRoundedBounds(block, Corners.All);

                        LinearGradientBrush blockBrush = new LinearGradientBrush(block, this.barcolor,
                                                                                 Color.White, LinearGradientMode.Horizontal);
                        // Draw the progress meter.

                        g.FillPath(blockBrush, barPath);
                    }

                    Rectangle remBlock = new Rectangle(left, top, remainder, height);
                    g.FillPath(barBrush, Rounder.GetRoundedBounds(remBlock, Corners.All));
                }

                // Draw a three-dimensional border around the control.
                //Draw3DBorder(g);
                Rectangle textArea = new Rectangle(new Point(this.ClientRectangle.Left, this.ClientRectangle.Top),
                                                   this.ClientRectangle.Size);
                g.DrawString(this.BackText, font, textBrush, textArea, sf);
            }

            // Clean up.
            brush.Dispose();
            textBrush.Dispose();
            barBrush.Dispose();
            g.Dispose();
        }