Пример #1
0
        /// <summary>
        /// Draws the background gradients of an Button
        /// </summary>
        /// <param name="g">The graphics surface to draw on</param>
        /// <param name="bounds">The bounds that the drawing should apply to</param>
        public override void DrawButtonBg(Graphics g, Rectangle bounds, ControlState state, InputState inputState)
        {
            Color[] endColors = new Color[1];

            if ((state == ControlState.Normal) && (inputState == InputState.Normal))
            {
                endColors = new Color[] { ColourTable.ButtonNormalColor2, ColourTable.ButtonNormalColor1 };
            }
            else if ((state == ControlState.Normal) && (inputState == InputState.Hovered))
            {
                endColors = new Color[] { ColourTable.ButtonHoveredColor2, ColourTable.ButtonHoveredColor1 };
            }
            else if ((state == ControlState.Active) && (inputState == InputState.Normal))
            {
                endColors = new Color[] { ColourTable.ButtonActiveColor2, ColourTable.ButtonActiveColor1 };
            }
            else if ((inputState == InputState.Clicked) ||
                     ((state == ControlState.Active) && (inputState == InputState.Hovered)))
            {
                endColors = new Color[] { ColourTable.ButtonActiveColor1, ColourTable.ButtonActiveColor2 };
            }

            float[] ColorPositions = { 0.0f, 1.0f };

            ExtDrawing.DrawVertGradient(g, bounds, endColors, ColorPositions);

            using (Pen p = new Pen(ColourTable.Border))
            {
                g.DrawLine(p, bounds.Left, bounds.Top, bounds.Right, bounds.Top);
            }
        }
Пример #2
0
        /// <summary>
        /// Draws the background of an Navigation band Client Area
        /// </summary>
        /// <param name="g">The graphics surface to draw on</param>
        /// <param name="bounds">The bounds that the drawing should apply to</param>
        /// <param name="state"></param>
        public override void DrawNaviBandClientAreaBg(Graphics g, Rectangle bounds)
        {
            // Gradient background
            activeBandBg = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppPArgb);
            using (Graphics bitmapG = Graphics.FromImage(activeBandBg))
            {
                Color[] endColors = new Color[] { ColourTable.NaviClientareaBgColor1,
                                                  ColourTable.NaviClientareaBgColor2 };

                float[] ColorPositions = { 0.0f, 1.0f };
                ExtDrawing.DrawVertGradient(bitmapG, bounds, endColors, ColorPositions);
            }

            g.DrawImageUnscaled(activeBandBg, new Point(bounds.X, bounds.Y));
        }
Пример #3
0
        /// <summary>
        /// Draws the background of the popped up band
        /// </summary>
        /// <param name="g">The canvas to draw on</param>
        /// <param name="bounds">The bounds of the drawing</param>
        public override void DrawNaviBandPopupBg(Graphics g, Rectangle bounds)
        {
            // Gradient background
            Color[] endColors = new Color[] { ColourTable.PopupBandBackground1, ColourTable.PopupBandBackground2 };

            float[] ColorPositions = { 0.0f, 1.0f };
            ExtDrawing.DrawVertGradient(g, bounds, endColors, ColorPositions);

            //bounds.Width -= 1;
            //bounds.Height -= 1;

            //using (Pen p = new Pen(ColorTable.Border))
            //using (Brush b = new SolidBrush(ColorTable.PopupBandBackground1))
            //{
            //   g.FillRectangle(b, bounds);
            //   g.DrawRectangle(p, bounds);
            //}
        }
Пример #4
0
        /// <summary>
        /// Draws the background of the collapsed band
        /// </summary>
        /// <param name="g">The canvas to draw on</param>
        /// <param name="bounds">The bounds of the drawing</param>
        /// <param name="text">The text that should appear into the bar</param>
        /// <param name="font">The font to use when drawing the text</param>
        /// <param name="state">The inputstate of the collapsed band</param>
        public override void DrawNaviBandCollapsedBg(Graphics g, Rectangle bounds, string text, Font font,
                                                     bool rightToLeft, InputState state)
        {
            // Gradient background
            Color[] endColors = new Color[] { ColourTable.BandCollapsedBgColor1, ColourTable.BandCollapsedBgColor2 };

            if (state == InputState.Clicked)
            {
                endColors = new Color[] { ColourTable.BandCollapsedClickedColor1, ColourTable.BandCollapsedClickedColor1 }
            }
            ;
            else if (state == InputState.Hovered)
            {
                endColors = new Color[] { ColourTable.BandCollapsedHoveredColor1, ColourTable.BandCollapsedHoveredColor1 }
            }
            ;

            float[] ColorPositions = { 0.0f, 1.0f };
            ExtDrawing.DrawVertGradient(g, bounds, endColors, ColorPositions);

            bounds.Width  -= 1;
            bounds.Height -= 1;

            if ((state == InputState.Hovered))
            {
                bounds.Inflate(new Size(-1, -1));
                using (Pen p = new Pen(ColourTable.Border))
                {
                    g.DrawRectangle(p, bounds);
                }

                bounds.Inflate(new Size(-1, -1));

                // Background gradient
                if (state == InputState.Hovered)
                {
                    endColors = new Color[] { ColourTable.ButtonHoveredColor1, ColourTable.ButtonHoveredColor2,
                                              ColourTable.ButtonHoveredColor3 }
                }
                ;
                else
                {
                    endColors = new Color[] { ColourTable.ButtonActiveColor1, ColourTable.ButtonActiveColor2,
                                              ColourTable.ButtonActiveColor3 }
                };

                float[] ColorPositions2 = { 0.0f, 0.4f, 1.0f };
                ExtDrawing.DrawHorGradient(g, bounds, endColors, ColorPositions2);

                // Draws a nice shiney glow on the bottom of the button
                endColors = new Color[] { Color.FromArgb(1, ColourTable.ButtonActiveColor4) };
                GraphicsPath path = new GraphicsPath();
                path.AddEllipse(0, bounds.Height / 2, bounds.Width, bounds.Height);
                ExtDrawing.DrawRadialGradient(g, path, bounds, Color.FromArgb(150,
                                                                              ColourTable.ButtonActiveColor4), endColors);

                // Inner borders
                if (state == InputState.Hovered)
                {
                    using (Pen p = new Pen(ColourTable.BorderInner))
                    {
                        g.DrawRectangle(p, bounds);
                    }
                }
            }
            else if (state == InputState.Clicked)
            {
                bounds.Inflate(new Size(-1, -1));
                using (Pen p = new Pen(ColourTable.Border))
                {
                    g.DrawRectangle(p, bounds);
                }

                // Background gradient
                endColors = new Color[] { ColourTable.ButtonClickedColor3, ColourTable.ButtonClickedColor2,
                                          ColourTable.ButtonClickedColor1 };

                float[] ColorPositions2 = { 0.0f, 0.8f, 1.0f };
                ExtDrawing.DrawVertGradient(g, bounds, endColors, ColorPositions2);
            }



            using (Brush brush = new SolidBrush(ColourTable.Text))
            {
                if (rightToLeft)
                {
                    Point ptCenter = new Point(bounds.X + bounds.Width / 2 + 7, bounds.Y +
                                               bounds.Height / 2);
                    System.Drawing.Drawing2D.Matrix transform = g.Transform;
                    transform.RotateAt(90, ptCenter);
                    g.Transform = transform;
                    using (StringFormat format = new StringFormat())
                    {
                        format.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
                        g.DrawString(text, font, brush, ptCenter, format);
                    }
                }
                else
                {
                    Point ptCenter = new Point(bounds.X + bounds.Width / 2 - 7, bounds.Y +
                                               bounds.Height / 2);
                    System.Drawing.Drawing2D.Matrix transform = g.Transform;
                    transform.RotateAt(270, ptCenter);
                    g.Transform = transform;
                    g.DrawString(text, font, brush, ptCenter);
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Draws the surface of the Collapse button
        /// </summary>
        /// <param name="g">The graphics surface to draw on</param>
        /// <param name="bounds">The bounds that the drawing should apply to</param>
        /// <param name="inputState">The input state of the control</param>
        /// <param name="rightToLeft">Right to left or left to right</param>
        /// <param name="collapsed">The bar is collasped or not</param>
        public override void DrawButtonCollapseBg(Graphics g, Rectangle bounds, InputState inputState, bool rightToLeft,
                                                  bool collapsed)
        {
            Color[] endColors = new Color[1];

            using (Brush b = new SolidBrush(ColourTable.HeaderColor1))
            {
                g.FillRectangle(b, bounds);
            }

            Rectangle buttonBounds = bounds;

            buttonBounds.Width  -= 1;
            buttonBounds.Height -= 1;

            if (inputState == InputState.Hovered)
            {
                buttonBounds.Inflate(new Size(-1, -1));
                using (Pen p = new Pen(ColourTable.Border))
                {
                    g.DrawRectangle(p, buttonBounds);
                }

                buttonBounds.Inflate(new Size(-1, -1));

                // Background gradient
                endColors = new Color[] { ColourTable.ButtonHoveredColor1, ColourTable.ButtonHoveredColor2,
                                          ColourTable.ButtonHoveredColor3 };

                float[] ColorPositions = { 0.0f, 0.4f, 1.0f };
                ExtDrawing.DrawVertGradient(g, buttonBounds, endColors, ColorPositions);

                // Draws a nice shiney glow on the bottom of the button
                endColors = new Color[] { Color.FromArgb(1, ColourTable.ButtonActiveColor4) };
                GraphicsPath path = new GraphicsPath();
                path.AddEllipse(0, buttonBounds.Height / 2, buttonBounds.Width, buttonBounds.Height);
                ExtDrawing.DrawRadialGradient(g, path, buttonBounds, Color.FromArgb(150,
                                                                                    ColourTable.ButtonActiveColor4), endColors);

                // Inner borders
                using (Pen p = new Pen(ColourTable.BorderInner))
                {
                    g.DrawRectangle(p, buttonBounds);
                }
            }

            using (Pen pen = new Pen(ColourTable.Border, 2.0f))
            {
                // Arrows
                //pen.Width = 2;
                pen.EndCap   = LineCap.Triangle;
                pen.StartCap = LineCap.Triangle;
                pen.Color    = ColourTable.ShapesFront;

                //width-7
                //(height/2)+1
                // w=7 h=4
                float x = 0;
                float y = 0;

                if (bounds.Height != 0)
                {
                    y = (bounds.Height / 2) - 3;
                }

                if (bounds.Width != 0)
                {
                    x = (bounds.Width / 2) - 1;
                }

                if (((rightToLeft) && (!collapsed)) || (!rightToLeft) && (collapsed))
                {
                    PointF[] points = { new PointF(x - 2, y),
                                        new PointF(x + 1, y + 3),
                                        new PointF(x - 2, y + 3 + 3) };

                    g.DrawLines(pen, points);
                }
                else
                {
                    PointF[] points = { new PointF(x + 1, y),
                                        new PointF(x - 2, y + 3),
                                        new PointF(x + 1, y + 3 + 3) };
                    g.DrawLines(pen, points);
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Draws the background gradients of an Button
        /// </summary>
        /// <param name="g">The graphics surface to draw on</param>
        /// <param name="bounds">The bounds that the drawing should apply to</param>
        public override void DrawButtonBg(Graphics g, Rectangle bounds, ControlState state, InputState inputState)
        {
            Color[] endColors = new Color[1];

            using (Brush b = new SolidBrush(ColourTable.ButtonNormalColor1))
            {
                g.FillRectangle(b, bounds);
            }

            bounds.Width  -= 1;
            bounds.Height -= 1;

            if (((state == ControlState.Active) && (inputState == InputState.Normal)) ||
                (inputState == InputState.Hovered))
            {
                bounds.Inflate(new Size(-1, -1));
                using (Pen p = new Pen(ColourTable.Border))
                {
                    g.DrawRectangle(p, bounds);
                }

                bounds.Inflate(new Size(-1, -1));

                // Background gradient
                if (inputState == InputState.Hovered)
                {
                    endColors = new Color[] { ColourTable.ButtonHoveredColor1, ColourTable.ButtonHoveredColor2,
                                              ColourTable.ButtonHoveredColor3 }
                }
                ;
                else
                {
                    endColors = new Color[] { ColourTable.ButtonActiveColor1, ColourTable.ButtonActiveColor2,
                                              ColourTable.ButtonActiveColor3 }
                };

                float[] ColorPositions = { 0.0f, 0.4f, 1.0f };
                ExtDrawing.DrawVertGradient(g, bounds, endColors, ColorPositions);

                // Draws a nice shiney glow on the bottom of the button

                if (inputState == InputState.Hovered)
                {
                    endColors = new Color[] { Color.FromArgb(1, ColourTable.ButtonHoveredColor4) }
                }
                ;
                else
                {
                    endColors = new Color[] { Color.FromArgb(1, ColourTable.ButtonActiveColor4) }
                };

                Color startColor;
                if (inputState == InputState.Hovered)
                {
                    startColor = Color.FromArgb(150, ColourTable.ButtonHoveredColor4);
                }
                else
                {
                    startColor = Color.FromArgb(150, ColourTable.ButtonActiveColor4);
                }

                GraphicsPath path = new GraphicsPath();
                path.AddEllipse(0, bounds.Height / 2, bounds.Width, bounds.Height);
                ExtDrawing.DrawRadialGradient(g, path, bounds, startColor, endColors);

                // Inner borders
                if (inputState == InputState.Hovered)
                {
                    using (Pen p = new Pen(ColourTable.BorderInner))
                    {
                        g.DrawRectangle(p, bounds);
                    }
                }
            }
            else if (inputState == InputState.Clicked)
            {
                bounds.Inflate(new Size(-1, -1));
                using (Pen p = new Pen(ColourTable.Border))
                {
                    g.DrawRectangle(p, bounds);
                }

                // Background gradient
                endColors = new Color[] { ColourTable.ButtonClickedColor3, ColourTable.ButtonClickedColor2,
                                          ColourTable.ButtonClickedColor1 };

                float[] ColorPositions = { 0.0f, 0.8f, 1.0f };
                ExtDrawing.DrawVertGradient(g, bounds, endColors, ColorPositions);
            }
        }