Example #1
0
        private void RenderSysMenuIcon(Rectangle rcMenuIcon, Graphics g)
        {
            using (GraphicsPath EMenuIconPath = BuildMenuIconShape(ref rcMenuIcon))
            {
                if (m_MenuIconMix == null || m_MenuIconMix.Count != 5)
                {
                    m_MenuIconMix = new List <Color>();
                    m_MenuIconMix.Add(Color.FromArgb(227, 235, 247));
                    m_MenuIconMix.Add(Color.FromArgb(221, 234, 251));
                    m_MenuIconMix.Add(Color.FromArgb(205, 224, 248));
                    m_MenuIconMix.Add(Color.FromArgb(217, 232, 250));
                    m_MenuIconMix.Add(Color.FromArgb(223, 236, 252));
                }
                FillMenuIconGradient(EMenuIconPath, g, m_MenuIconMix);

                using (EAntiAlias xaa = new EAntiAlias(g))
                {
                    DrawInnerMenuIconBorder(rcMenuIcon, g, m_clrMenuIconBorderInner);
                    g.DrawPath(new Pen(m_clrMenuIconBorderOuter), EMenuIconPath);
                }
            }

            #region Draw icon

            if (m_bmpMenuIcon != null)
            {
                int lH = m_bmpMenuIcon.Height;
                int lW = m_bmpMenuIcon.Width;

                Rectangle rcImage = new Rectangle((rcMenuIcon.Right - rcMenuIcon.Width / 2) - lW / 2 - 2, (rcMenuIcon.Bottom - rcMenuIcon.Height / 2) - lH / 2, lW, lH);
                g.DrawImage(m_bmpMenuIcon, rcImage);
            }

            #endregion
        }
Example #2
0
        private void FillMenuIconGradient(GraphicsPath XFillPath, Graphics g, List <Color> mix)
        {
            using (EAntiAlias xaa = new EAntiAlias(g))
            {
                using (LinearGradientBrush lgb = new LinearGradientBrush(XFillPath.GetBounds(), mix[0], mix[4], LinearGradientMode.Vertical))
                {
                    lgb.InterpolationColors = EFormHelper.ColorMix(mix, false);

                    g.FillPath(lgb, XFillPath);
                }
            }
        }
        /// <summary>
        /// Main rendering method.
        /// </summary>
        /// <param name="rcBorder">Border bounds</param>
        /// <param name="g">Graphics object</param>
        public void Render(Rectangle rcBorder, Graphics g)
        {
            GraphicsPath XBorderPath = new GraphicsPath();

            switch (m_eBorderStyle)
            {
            case EBorderStyle.E3D:
                switch (m_eBorderType)
                {
                case EBorderType.Rectangular:
                    using (EAntiAlias xaa = new EAntiAlias(g))
                    {
                        DrawBorderLine(g, XBorderPath, rcBorder, 0, false);
                    }
                    break;

                case EBorderType.Rounded:
                    DrawBorderLine(g, XBorderPath, rcBorder, m_lRadius, false);
                    break;

                case EBorderType.Inclinated:
                    DrawBorderLine(g, XBorderPath, rcBorder, 0, false);
                    break;
                }
                break;

            case EBorderStyle.Flat:
                switch (m_eBorderType)
                {
                case EBorderType.Rectangular:
                    using (EAntiAlias xaa = new EAntiAlias(g))
                    {
                        DrawBorderLine(g, XBorderPath, rcBorder, 0, true);
                    }
                    break;

                case EBorderType.Rounded:
                    DrawBorderLine(g, XBorderPath, rcBorder, m_lRadius, true);
                    break;

                case EBorderType.Inclinated:
                    DrawBorderLine(g, XBorderPath, rcBorder, 0, false);
                    break;
                }
                break;
            }
        }
Example #4
0
        private void DrawStatusGlow(Rectangle rect, Graphics g, Color clrGlowColor)
        {
            Rectangle rcGlow = rect;

            using (LinearGradientBrush lgbGlow = new LinearGradientBrush(
                       rcGlow,
                       Color.FromArgb(30, clrGlowColor),
                       Color.FromArgb(150, clrGlowColor),
                       LinearGradientMode.Vertical))
            {
                if (m_bEllipticalGlow)
                {
                    g.SetClip(rect);
                    using (EAntiAlias xaa = new EAntiAlias(g))
                    {
                        using (GraphicsPath XEllipseGlow = new GraphicsPath())
                        {
                            XEllipseGlow.AddEllipse(
                                rect.Left - 5,
                                rect.Top - rect.Height / 2,
                                rect.Width + 10,
                                rect.Height);

                            g.FillPath(
                                lgbGlow,
                                XEllipseGlow
                                );
                        }
                    }
                    g.ResetClip();
                }
                else
                {
                    rcGlow.Height = 5;
                    g.FillRectangle(
                        lgbGlow,
                        rcGlow
                        );
                }
            }
        }
Example #5
0
        /// <summary>
        /// Fills titlebar button.
        /// </summary>
        /// <param name="rcBtn">Button bounding rectangle.</param>
        /// <param name="g">Graphics object.</param>
        /// <param name="clrStart">Color used to fill the button.</param>
        /// <param name="clrEnd">Color used to fill the outer glow.</param>
        /// <param name="XBoxClip">Path to perform clipping tasks.</param>
        private void FillButton(Rectangle rcBtn, Graphics g, Color clrStart, Color clrEnd, GraphicsPath XBoxClip)
        {
            switch (m_eFillMode)
            {
            case EButtonFillMode.UpperGlow:
                rcBtn.Height = 3;
                using (LinearGradientBrush lgb = new LinearGradientBrush(rcBtn, clrStart, clrEnd, LinearGradientMode.Vertical))
                {
                    g.FillRectangle(lgb, rcBtn);
                }
                break;

            case EButtonFillMode.FullFill:
                // restrict drawing inside button box / rectangle:
                g.SetClip(XBoxClip);
                g.SetClip(rcBtn, CombineMode.Intersect);

                #region Fill button

                using (SolidBrush sb = new SolidBrush(clrStart))
                {
                    g.FillRectangle(sb, rcBtn);
                }

                #endregion

                using (EAntiAlias xaa = new EAntiAlias(g))
                {
                    #region Fill shine

                    using (GraphicsPath XBtnGlow = new GraphicsPath())
                    {
                        XBtnGlow.AddEllipse(rcBtn.Left - 5, rcBtn.Bottom - rcBtn.Height / 2 + 3, rcBtn.Width + 11, rcBtn.Height + 11);
                        using (PathGradientBrush pgb = new PathGradientBrush(XBtnGlow))
                        {
                            pgb.CenterColor    = Color.FromArgb(235, Color.White);
                            pgb.SurroundColors = new Color[] { Color.FromArgb(0, clrEnd) };
                            pgb.SetSigmaBellShape(0.8f);

                            g.FillPath(pgb, XBtnGlow);
                        }
                    }

                    #endregion

                    #region Fill upper glow

                    rcBtn.Height = rcBtn.Height / 2 - 2;
                    using (LinearGradientBrush lgb = new LinearGradientBrush(rcBtn, Color.FromArgb(80, Color.White), Color.FromArgb(140, Color.White), LinearGradientMode.Vertical))
                    {
                        using (GraphicsPath XGlowPath = EFormHelper.RoundRect((RectangleF)rcBtn, 0, 0, 4, 4))
                        {
                            lgb.WrapMode = WrapMode.TileFlipXY;
                            g.FillPath(lgb, XGlowPath);
                        }
                    }

                    #endregion
                }
                // reset clipping back:
                g.ResetClip();
                break;
            }
        }
Example #6
0
        /// <summary>
        /// Fills titlebar button.
        /// </summary>
        /// <param name="rcBtn">Button bounding rectangle.</param>
        /// <param name="g">Graphics object.</param>
        /// <param name="clrStart">Color used to fill the button.</param>
        /// <param name="clrEnd">Color used to fill the outer glow.</param>
        /// <param name="XBoxClip">Path to perform clipping tasks.</param>
        private void FillButton(Rectangle rcBtn, Graphics g, Color clrStart, Color clrEnd, GraphicsPath XBoxClip)
        {
            switch (m_eFillMode)
            {
                case EButtonFillMode.UpperGlow:
                    rcBtn.Height = 3;
                    using (LinearGradientBrush lgb = new LinearGradientBrush(rcBtn, clrStart, clrEnd, LinearGradientMode.Vertical))
                    {
                        g.FillRectangle(lgb, rcBtn);
                    }
                    break;

                case EButtonFillMode.FullFill:
                    // restrict drawing inside button box / rectangle:
                    g.SetClip(XBoxClip);
                    g.SetClip(rcBtn, CombineMode.Intersect);

                    #region Fill button

                    using (SolidBrush sb = new SolidBrush(clrStart))
                    {
                        g.FillRectangle(sb, rcBtn);
                    }

                    #endregion

                    using (EAntiAlias xaa = new EAntiAlias(g))
                    {
                        #region Fill shine

                        using (GraphicsPath XBtnGlow = new GraphicsPath())
                        {
                            XBtnGlow.AddEllipse(rcBtn.Left - 5, rcBtn.Bottom - rcBtn.Height / 2 + 3, rcBtn.Width + 11, rcBtn.Height + 11);
                            using (PathGradientBrush pgb = new PathGradientBrush(XBtnGlow))
                            {
                                pgb.CenterColor = Color.FromArgb(235, Color.White);
                                pgb.SurroundColors = new Color[] { Color.FromArgb(0, clrEnd) };
                                pgb.SetSigmaBellShape(0.8f);

                                g.FillPath(pgb, XBtnGlow);
                            }
                        }

                        #endregion

                        #region Fill upper glow

                        rcBtn.Height = rcBtn.Height / 2 - 2;
                        using (LinearGradientBrush lgb = new LinearGradientBrush(rcBtn, Color.FromArgb(80, Color.White), Color.FromArgb(140, Color.White), LinearGradientMode.Vertical))
                        {
                            using (GraphicsPath XGlowPath = EFormHelper.RoundRect((RectangleF)rcBtn, 0, 0, 4, 4))
                            {
                                lgb.WrapMode = WrapMode.TileFlipXY;
                                g.FillPath(lgb, XGlowPath);
                            }
                        }

                        #endregion
                    }
                    // reset clipping back:
                    g.ResetClip();
                    break;
            }
        }
Example #7
0
        public void RenderCtrlButtonsBox(Rectangle rcBox, Graphics g, int lSinglePosX, int lSinglePosY)
        {
            using (EAntiAlias xaa = new EAntiAlias(g))
            {
                int lBtnWidth  = 0;
                int lBtnHeight = 0;
                foreach (EFormCtrlButtons btn in m_eCtrlButtons)
                {
                    if (btn.ButtonStyle == EFormCtrlButtons.EButtonStyle.MacStyle)
                    {
                        m_bShouldRenderButtonBox = false;
                    }
                    else
                    {
                        m_bShouldRenderButtonBox = true;
                    }

                    lBtnWidth  = btn.ButtonWidth;
                    lBtnHeight = btn.ButtonHeight;
                    break;
                }
                int lX = rcBox.Right - lBtnWidth;
                int lY = rcBox.Bottom - lBtnHeight;

                {
                    if (m_bShouldRenderButtonBox)
                    {
                        using (GraphicsPath XButtonBox = BuildCtrlButtonsBox(rcBox))
                        {
                            switch (m_eButtonBoxFill)
                            {
                            case EButtonBoxFill.ColorMix:
                                using (LinearGradientBrush lgb = new LinearGradientBrush(rcBox, m_ButtonBoxColors[0], m_ButtonBoxColors[4], LinearGradientMode.Vertical))
                                {
                                    lgb.InterpolationColors = EFormHelper.ColorMix(m_ButtonBoxColors, false);

                                    g.FillPath(lgb, XButtonBox);
                                }
                                break;

                            case EButtonBoxFill.TitleBarRectangleRendering:
                                RectangleF rcDownRect = XButtonBox.GetBounds();
                                RectangleF rcUpRect   = XButtonBox.GetBounds();
                                g.SetClip(XButtonBox);
                                rcUpRect.Height /= 2;
                                using (LinearGradientBrush lgbUpperRect = new LinearGradientBrush(rcUpRect, m_clrUpperFillStart, m_clrUpperFillEnd, LinearGradientMode.Vertical))
                                {
                                    lgbUpperRect.WrapMode = WrapMode.TileFlipY;
                                    g.FillRectangle(lgbUpperRect, rcUpRect);
                                }

                                rcDownRect.Height = rcDownRect.Height / 2;
                                rcDownRect.Y      = rcUpRect.Bottom;
                                using (LinearGradientBrush lgbDwnRect = new LinearGradientBrush(rcDownRect, m_clrFillStart, m_clrFillEnd, LinearGradientMode.Vertical))
                                {
                                    g.FillRectangle(lgbDwnRect, rcDownRect);
                                }

                                g.ResetClip();
                                break;
                            }

                            #region Draw button separators

                            g.DrawLine(new Pen(m_clrButtonBoxOuter), rcBox.Right - lBtnWidth, rcBox.Bottom, rcBox.Right - lBtnWidth, rcBox.Top + 1);
                            g.DrawLine(new Pen(m_clrButtonBoxInner), rcBox.Right - lBtnWidth - 1, rcBox.Bottom, rcBox.Right - lBtnWidth - 1, rcBox.Top + 1);
                            g.DrawLine(new Pen(m_clrButtonBoxOuter), rcBox.Right - lBtnWidth * 2, rcBox.Bottom - 2, rcBox.Right - lBtnWidth * 2, rcBox.Top + 1);
                            g.DrawLine(new Pen(m_clrButtonBoxInner), rcBox.Right - lBtnWidth * 2 - 1, rcBox.Bottom - 2, rcBox.Right - lBtnWidth * 2 - 1, rcBox.Top + 1);

                            #endregion

                            #region Render buttons

                            g.SetClip(XButtonBox);
                            foreach (EFormCtrlButtons btn in m_eCtrlButtons)
                            {
                                btn.ButtonLeft = lX;
                                btn.ButtonTop  = lY;

                                btn.RenderCtrlButtons(btn.ButtonLeft, btn.ButtonTop, g, XButtonBox);
                                lX -= btn.ButtonWidth + 1;
                            }
                            g.ResetClip();

                            #endregion

                            g.DrawPath(new Pen(m_clrButtonBoxOuter), XButtonBox);

                            DrawInnerCtrlBoxBorder(g, rcBox, m_clrButtonBoxInner);
                        }
                    }
                    else
                    {
                        int lSP = lSinglePosX;
                        foreach (EFormCtrlButtons btn in m_eCtrlButtons)
                        {
                            //btn.ButtonHeight = 13;
                            //btn.ButtonWidth = 13;
                            btn.ButtonLeft = lSP;
                            btn.ButtonTop  = lSinglePosY;

                            btn.RenderCtrlButtons(btn.ButtonLeft, btn.ButtonTop, g, null);
                            //lSP -= btn.ButtonWidth + 4;
                            lSP -= btn.ButtonWidth / 2 + 4;
                        }
                    }
                }
            }
        }
Example #8
0
        private void FillTitleBar(Graphics g, Rectangle rcTitleBar)
        {
            GraphicsPath XTitleBarPath = new GraphicsPath();

            XTitleBarPath = BuildTitleBarShape(rcTitleBar);
            using (EAntiAlias xaa = new EAntiAlias(g))
            {
                #region Fill titlebar

                switch (m_eTitleBarFill)
                {
                case ETitleBarFill.AdvancedRendering:
                    using (LinearGradientBrush lgb = new LinearGradientBrush(rcTitleBar, m_TitleBarMix[0], m_TitleBarMix[4], LinearGradientMode.Vertical))
                    {
                        lgb.InterpolationColors = EFormHelper.ColorMix(m_TitleBarMix, true);

                        g.FillPath(lgb, XTitleBarPath);
                    }

                    #region Draw titlebar glow

                    using (GraphicsPath XGlow = new GraphicsPath())
                    {
                        XGlow.AddEllipse(rcTitleBar.Left, rcTitleBar.Bottom / 2 + 4, rcTitleBar.Width, rcTitleBar.Height);

                        using (PathGradientBrush pgb = new PathGradientBrush(XGlow))
                        {
                            pgb.CenterColor    = Color.White;
                            pgb.SurroundColors = new Color[] { Color.FromArgb(0, 229, 121, 13) };

                            g.SetClip(XTitleBarPath);
                            g.FillPath(pgb, XGlow);
                            g.ResetClip();
                        }
                    }

                    #endregion

                    break;

                case ETitleBarFill.Texture:
                    if (m_TitleBarTexture != null)
                    {
                        using (TextureBrush tb = new TextureBrush(m_TitleBarTexture))
                        {
                            g.FillPath(tb, XTitleBarPath);
                        }
                    }
                    break;

                case ETitleBarFill.LinearRendering:
                    RectangleF rcLinearFill = XTitleBarPath.GetBounds();
                    g.SetClip(XTitleBarPath);
                    using (LinearGradientBrush lgbLinearFill = new LinearGradientBrush(rcLinearFill, m_clrFillStart, m_clrFillEnd, LinearGradientMode.Vertical))
                    {
                        g.FillRectangle(lgbLinearFill, rcLinearFill);
                    }

                    g.ResetClip();
                    break;

                case ETitleBarFill.UpperGlow:
                    RectangleF rcGlow = XTitleBarPath.GetBounds();
                    g.SetClip(XTitleBarPath);
                    rcGlow.Height /= 2;
                    using (LinearGradientBrush lgbUpperGlow = new LinearGradientBrush(rcGlow, m_clrUpperFillStart, m_clrUpperFillEnd, LinearGradientMode.Vertical))
                    {
                        g.FillRectangle(lgbUpperGlow, rcGlow);
                    }

                    g.ResetClip();
                    break;

                case ETitleBarFill.RectangleRendering:
                    RectangleF rcDownRect = XTitleBarPath.GetBounds();
                    RectangleF rcUpRect   = XTitleBarPath.GetBounds();
                    g.SetClip(XTitleBarPath);
                    rcUpRect.Height /= 2;
                    using (LinearGradientBrush lgbUpperRect = new LinearGradientBrush(rcUpRect, m_clrUpperFillStart, m_clrUpperFillEnd, LinearGradientMode.Vertical))
                    {
                        lgbUpperRect.WrapMode = WrapMode.TileFlipY;
                        g.FillRectangle(lgbUpperRect, rcUpRect);
                    }

                    rcDownRect.Height = rcDownRect.Height / 2;
                    rcDownRect.Y      = rcUpRect.Bottom;
                    using (LinearGradientBrush lgbDwnRect = new LinearGradientBrush(rcDownRect, m_clrFillStart, m_clrFillEnd, LinearGradientMode.Vertical))
                    {
                        g.FillRectangle(lgbDwnRect, rcDownRect);
                    }

                    g.ResetClip();
                    break;
                }

                #endregion

                #region Draw back image

                DrawTitleBarBackImage(g, rcTitleBar, XTitleBarPath);

                #endregion

                DrawOuterTitleBarBorder(g, rcTitleBar, m_clrOuterTitleBarColor);
                DrawInnerTitleBarBorder(g, rcTitleBar, m_clrInnerTitleBarColor);
            }
            XTitleBarPath.Dispose();
        }
Example #9
0
        private void FillTitleBar(Graphics g, Rectangle rcTitleBar)
        {
            GraphicsPath XTitleBarPath = new GraphicsPath();
            XTitleBarPath = BuildTitleBarShape(rcTitleBar);
            using (EAntiAlias xaa = new EAntiAlias(g))
            {
                #region Fill titlebar

                switch (m_eTitleBarFill)
                {
                    case ETitleBarFill.AdvancedRendering:
                        using (LinearGradientBrush lgb = new LinearGradientBrush(rcTitleBar, m_TitleBarMix[0], m_TitleBarMix[4], LinearGradientMode.Vertical))
                        {
                            lgb.InterpolationColors = EFormHelper.ColorMix(m_TitleBarMix, true);

                            g.FillPath(lgb, XTitleBarPath);
                        }

                        #region Draw titlebar glow

                        using (GraphicsPath XGlow = new GraphicsPath())
                        {
                            XGlow.AddEllipse(rcTitleBar.Left, rcTitleBar.Bottom / 2 + 4, rcTitleBar.Width, rcTitleBar.Height);

                            using (PathGradientBrush pgb = new PathGradientBrush(XGlow))
                            {
                                pgb.CenterColor = Color.White;
                                pgb.SurroundColors = new Color[] { Color.FromArgb(0, 229, 121, 13) };

                                g.SetClip(XTitleBarPath);
                                g.FillPath(pgb, XGlow);
                                g.ResetClip();
                            }
                        }

                        #endregion

                        break;

                    case ETitleBarFill.Texture:
                        if (m_TitleBarTexture != null)
                        {
                            using (TextureBrush tb = new TextureBrush(m_TitleBarTexture))
                            {
                                g.FillPath(tb, XTitleBarPath);
                            }
                        }
                        break;

                    case ETitleBarFill.LinearRendering:
                        RectangleF rcLinearFill = XTitleBarPath.GetBounds();
                        g.SetClip(XTitleBarPath);
                        using (LinearGradientBrush lgbLinearFill = new LinearGradientBrush(rcLinearFill, m_clrFillStart, m_clrFillEnd, LinearGradientMode.Vertical))
                        {
                            g.FillRectangle(lgbLinearFill, rcLinearFill);
                        }

                        g.ResetClip();
                        break;

                    case ETitleBarFill.UpperGlow:
                        RectangleF rcGlow = XTitleBarPath.GetBounds();
                        g.SetClip(XTitleBarPath);
                        rcGlow.Height /= 2;
                        using (LinearGradientBrush lgbUpperGlow = new LinearGradientBrush(rcGlow, m_clrUpperFillStart, m_clrUpperFillEnd, LinearGradientMode.Vertical))
                        {
                            g.FillRectangle(lgbUpperGlow, rcGlow);
                        }

                        g.ResetClip();
                        break;

                    case ETitleBarFill.RectangleRendering:
                        RectangleF rcDownRect = XTitleBarPath.GetBounds();
                        RectangleF rcUpRect = XTitleBarPath.GetBounds();
                        g.SetClip(XTitleBarPath);
                        rcUpRect.Height /= 2;
                        using (LinearGradientBrush lgbUpperRect = new LinearGradientBrush(rcUpRect, m_clrUpperFillStart, m_clrUpperFillEnd, LinearGradientMode.Vertical))
                        {
                            lgbUpperRect.WrapMode = WrapMode.TileFlipY;
                            g.FillRectangle(lgbUpperRect, rcUpRect);
                        }

                        rcDownRect.Height = rcDownRect.Height / 2;
                        rcDownRect.Y = rcUpRect.Bottom;
                        using (LinearGradientBrush lgbDwnRect = new LinearGradientBrush(rcDownRect, m_clrFillStart, m_clrFillEnd, LinearGradientMode.Vertical))
                        {
                            g.FillRectangle(lgbDwnRect, rcDownRect);
                        }

                        g.ResetClip();
                        break;
                }

                #endregion

                #region Draw back image

                DrawTitleBarBackImage(g, rcTitleBar, XTitleBarPath);

                #endregion

                DrawOuterTitleBarBorder(g, rcTitleBar, m_clrOuterTitleBarColor);
                DrawInnerTitleBarBorder(g, rcTitleBar, m_clrInnerTitleBarColor);
            }
            XTitleBarPath.Dispose();
        }
Example #10
0
        public void RenderCtrlButtonsBox(Rectangle rcBox, Graphics g, int lSinglePosX, int lSinglePosY)
        {
            using (EAntiAlias xaa = new EAntiAlias(g))
            {
                int lBtnWidth = 0;
                int lBtnHeight = 0;
                foreach (EFormCtrlButtons btn in m_eCtrlButtons)
                {
                    if (btn.ButtonStyle == EFormCtrlButtons.EButtonStyle.MacStyle)
                        m_bShouldRenderButtonBox = false;
                    else
                        m_bShouldRenderButtonBox = true;

                    lBtnWidth = btn.ButtonWidth;
                    lBtnHeight = btn.ButtonHeight;
                    break;
                }
                int lX = rcBox.Right - lBtnWidth;
                int lY = rcBox.Bottom - lBtnHeight;

                {
                    if (m_bShouldRenderButtonBox)
                    {
                        using (GraphicsPath XButtonBox = BuildCtrlButtonsBox(rcBox))
                        {
                            switch (m_eButtonBoxFill)
                            {
                                case EButtonBoxFill.ColorMix:
                                    using (LinearGradientBrush lgb = new LinearGradientBrush(rcBox, m_ButtonBoxColors[0], m_ButtonBoxColors[4], LinearGradientMode.Vertical))
                                    {
                                        lgb.InterpolationColors = EFormHelper.ColorMix(m_ButtonBoxColors, false);

                                        g.FillPath(lgb, XButtonBox);
                                    }
                                    break;

                                case EButtonBoxFill.TitleBarRectangleRendering:
                                    RectangleF rcDownRect = XButtonBox.GetBounds();
                                    RectangleF rcUpRect = XButtonBox.GetBounds();
                                    g.SetClip(XButtonBox);
                                    rcUpRect.Height /= 2;
                                    using (LinearGradientBrush lgbUpperRect = new LinearGradientBrush(rcUpRect, m_clrUpperFillStart, m_clrUpperFillEnd, LinearGradientMode.Vertical))
                                    {
                                        lgbUpperRect.WrapMode = WrapMode.TileFlipY;
                                        g.FillRectangle(lgbUpperRect, rcUpRect);
                                    }

                                    rcDownRect.Height = rcDownRect.Height / 2;
                                    rcDownRect.Y = rcUpRect.Bottom;
                                    using (LinearGradientBrush lgbDwnRect = new LinearGradientBrush(rcDownRect, m_clrFillStart, m_clrFillEnd, LinearGradientMode.Vertical))
                                    {
                                        g.FillRectangle(lgbDwnRect, rcDownRect);
                                    }

                                    g.ResetClip();
                                    break;
                            }

                            #region Draw button separators

                            g.DrawLine(new Pen(m_clrButtonBoxOuter), rcBox.Right - lBtnWidth, rcBox.Bottom, rcBox.Right - lBtnWidth, rcBox.Top + 1);
                            g.DrawLine(new Pen(m_clrButtonBoxInner), rcBox.Right - lBtnWidth - 1, rcBox.Bottom, rcBox.Right - lBtnWidth - 1, rcBox.Top + 1);
                            g.DrawLine(new Pen(m_clrButtonBoxOuter), rcBox.Right - lBtnWidth * 2, rcBox.Bottom - 2, rcBox.Right - lBtnWidth * 2, rcBox.Top + 1);
                            g.DrawLine(new Pen(m_clrButtonBoxInner), rcBox.Right - lBtnWidth * 2 - 1, rcBox.Bottom - 2, rcBox.Right - lBtnWidth * 2 - 1, rcBox.Top + 1);

                            #endregion

                            #region Render buttons

                            g.SetClip(XButtonBox);
                            foreach (EFormCtrlButtons btn in m_eCtrlButtons)
                            {
                                btn.ButtonLeft = lX;
                                btn.ButtonTop = lY;

                                btn.RenderCtrlButtons(btn.ButtonLeft, btn.ButtonTop, g, XButtonBox);
                                lX -= btn.ButtonWidth + 1;
                            }
                            g.ResetClip();

                            #endregion

                            g.DrawPath(new Pen(m_clrButtonBoxOuter), XButtonBox);

                            DrawInnerCtrlBoxBorder(g, rcBox, m_clrButtonBoxInner);
                        }
                    }
                    else
                    {
                        int lSP = lSinglePosX;
                        foreach (EFormCtrlButtons btn in m_eCtrlButtons)
                        {
                            //btn.ButtonHeight = 13;
                            //btn.ButtonWidth = 13;
                            btn.ButtonLeft = lSP;
                            btn.ButtonTop = lSinglePosY;

                            btn.RenderCtrlButtons(btn.ButtonLeft, btn.ButtonTop, g, null);
                            //lSP -= btn.ButtonWidth + 4;
                            lSP -= btn.ButtonWidth / 2 + 4;
                        }
                    }
                }
            }
        }
        public void RenderHolderButtons(int x, int y, Graphics g)
        {
            int lX = x;
            Rectangle rcIcon = new Rectangle();
            RectangleF rcImage = new RectangleF();
            RectangleF rcFrame = new RectangleF();

            foreach (EHolderButton xbtn in m_ehButtons)
            {
                if (xbtn.ButtonImage != null)
                {
                    xbtn.Left = lX;
                    xbtn.Top = y + 1;

                    rcIcon = new Rectangle(lX, y + 1, xbtn.ButtonImage.Size.Width, xbtn.ButtonImage.Size.Height);

                    if (xbtn.Hot)
                    {
                        using (EAntiAlias xaa = new EAntiAlias(g))
                        {
                            using (GraphicsPath XHolderBtnPath = BuildHolderButtonFrame(rcIcon, 100, 40))
                            {
                                using (LinearGradientBrush lgb = new LinearGradientBrush(XHolderBtnPath.GetBounds(),
                                                                                         Color.FromArgb(xbtn.FrameAlpha, xbtn.FrameStartColor),
                                                                                         Color.FromArgb(xbtn.FrameAlpha, xbtn.FrameEndColor),
                                                                                         LinearGradientMode.Vertical
                                                                                        )
                                      )
                                {
                                    g.FillPath(lgb, XHolderBtnPath);
                                }

                                rcFrame = XHolderBtnPath.GetBounds();
                            }
                            int lFrameImageWidth = 0;
                            if (xbtn.FrameBackImage != null)
                            {
                                // draw frame image:
                                rcImage = new RectangleF(rcFrame.Right - xbtn.FrameBackImage.Width,
                                                          rcFrame.Bottom - xbtn.FrameBackImage.Height,
                                                          xbtn.FrameBackImage.Width,
                                                          xbtn.FrameBackImage.Height
                                                        );
                                g.DrawImage(xbtn.FrameBackImage, rcImage);
                                lFrameImageWidth = xbtn.FrameBackImage.Height;
                            }
                            // draw caption / description:
                            g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                            g.DrawString(xbtn.HolderButtonCaption,
                                         xbtn.HolderButtonCaptionFont,
                                         new SolidBrush(xbtn.HolderButtonCaptionColor),
                                         rcFrame.Left + 2,
                                         rcIcon.Bottom + 4
                                        );

                            StringFormat sf = new StringFormat();
                            sf.Alignment = StringAlignment.Near;
                            sf.LineAlignment = StringAlignment.Near;
                            sf.Trimming = StringTrimming.EllipsisCharacter;
                            sf.FormatFlags = StringFormatFlags.LineLimit;

                            float fCaptionWidth = g.MeasureString(xbtn.HolderButtonCaption, xbtn.HolderButtonCaptionFont).Height;

                            RectangleF rcDescription = new RectangleF(rcFrame.Left + 2,
                                                                      rcIcon.Bottom + fCaptionWidth,
                                                                      rcFrame.Width,
                                                                      rcFrame.Height - lFrameImageWidth
                                                                     );
                            g.DrawString(xbtn.HolderButtonDescription,
                                         xbtn.HolderButtonDescriptionFont,
                                         new SolidBrush(xbtn.HolderButtonDescriptionColor),
                                         rcDescription,
                                         sf
                                        );
                        }
                    }

                    // draw button:
                    g.DrawImage(xbtn.ButtonImage, rcIcon);

                    xbtn.ButtonRectangle = rcIcon;

                    // update position:
                    lX += rcIcon.Width + 2;
                }
            }
        }
Example #12
0
        private void RenderSysMenuIcon(Rectangle rcMenuIcon, Graphics g)
        {
            using (GraphicsPath EMenuIconPath = BuildMenuIconShape(ref rcMenuIcon))
            {
                if (m_MenuIconMix == null || m_MenuIconMix.Count != 5)
                {
                    m_MenuIconMix = new List<Color>();
                    m_MenuIconMix.Add(Color.FromArgb(227, 235, 247));
                    m_MenuIconMix.Add(Color.FromArgb(221, 234, 251));
                    m_MenuIconMix.Add(Color.FromArgb(205, 224, 248));
                    m_MenuIconMix.Add(Color.FromArgb(217, 232, 250));
                    m_MenuIconMix.Add(Color.FromArgb(223, 236, 252));
                }
                FillMenuIconGradient(EMenuIconPath, g, m_MenuIconMix);

                using (EAntiAlias xaa = new EAntiAlias(g))
                {
                    DrawInnerMenuIconBorder(rcMenuIcon, g, m_clrMenuIconBorderInner);
                    g.DrawPath(new Pen(m_clrMenuIconBorderOuter), EMenuIconPath);
                }
            }

            #region Draw icon

            if (m_bmpMenuIcon != null)
            {
                int lH = m_bmpMenuIcon.Height;
                int lW = m_bmpMenuIcon.Width;

                Rectangle rcImage = new Rectangle((rcMenuIcon.Right - rcMenuIcon.Width / 2) - lW / 2 - 2, (rcMenuIcon.Bottom - rcMenuIcon.Height / 2) - lH / 2, lW, lH);
                g.DrawImage(m_bmpMenuIcon, rcImage);
            }

            #endregion
        }
Example #13
0
        private void FillMenuIconGradient(GraphicsPath XFillPath, Graphics g, List<Color> mix)
        {
            using (EAntiAlias xaa = new EAntiAlias(g))
            {
                using (LinearGradientBrush lgb = new LinearGradientBrush(XFillPath.GetBounds(), mix[0], mix[4], LinearGradientMode.Vertical))
                {
                    lgb.InterpolationColors = EFormHelper.ColorMix(mix, false);

                    g.FillPath(lgb, XFillPath);
                }
            }
        }
        /// <summary>
        /// Main rendering method.
        /// </summary>
        /// <param name="rcBorder">Border bounds</param>
        /// <param name="g">Graphics object</param>
        public void Render(Rectangle rcBorder, Graphics g)
        {
            GraphicsPath XBorderPath = new GraphicsPath();
            switch (m_eBorderStyle)
            {
                case EBorderStyle.E3D:
                    switch (m_eBorderType)
                    {
                        case EBorderType.Rectangular:
                            using (EAntiAlias xaa = new EAntiAlias(g))
                            {
                                DrawBorderLine(g, XBorderPath, rcBorder, 0, false);
                            }
                            break;

                        case EBorderType.Rounded:
                            DrawBorderLine(g, XBorderPath, rcBorder, m_lRadius, false);
                            break;

                        case EBorderType.Inclinated:
                            DrawBorderLine(g, XBorderPath, rcBorder, 0, false);
                            break;
                    }
                    break;

                case EBorderStyle.Flat:
                    switch (m_eBorderType)
                    {
                        case EBorderType.Rectangular:
                            using (EAntiAlias xaa = new EAntiAlias(g))
                            {
                                DrawBorderLine(g, XBorderPath, rcBorder, 0, true);
                            }
                            break;

                        case EBorderType.Rounded:
                            DrawBorderLine(g, XBorderPath, rcBorder, m_lRadius, true);
                            break;

                        case EBorderType.Inclinated:
                            DrawBorderLine(g, XBorderPath, rcBorder, 0, false);
                            break;
                    }
                    break;
            }
        }
        public void RenderHolderButtons(int x, int y, Graphics g)
        {
            int        lX      = x;
            Rectangle  rcIcon  = new Rectangle();
            RectangleF rcImage = new RectangleF();
            RectangleF rcFrame = new RectangleF();

            foreach (EHolderButton xbtn in m_ehButtons)
            {
                if (xbtn.ButtonImage != null)
                {
                    xbtn.Left = lX;
                    xbtn.Top  = y + 1;

                    rcIcon = new Rectangle(lX, y + 1, xbtn.ButtonImage.Size.Width, xbtn.ButtonImage.Size.Height);

                    if (xbtn.Hot)
                    {
                        using (EAntiAlias xaa = new EAntiAlias(g))
                        {
                            using (GraphicsPath XHolderBtnPath = BuildHolderButtonFrame(rcIcon, 100, 40))
                            {
                                using (LinearGradientBrush lgb = new LinearGradientBrush(XHolderBtnPath.GetBounds(),
                                                                                         Color.FromArgb(xbtn.FrameAlpha, xbtn.FrameStartColor),
                                                                                         Color.FromArgb(xbtn.FrameAlpha, xbtn.FrameEndColor),
                                                                                         LinearGradientMode.Vertical
                                                                                         )
                                       )
                                {
                                    g.FillPath(lgb, XHolderBtnPath);
                                }

                                rcFrame = XHolderBtnPath.GetBounds();
                            }
                            int lFrameImageWidth = 0;
                            if (xbtn.FrameBackImage != null)
                            {
                                // draw frame image:
                                rcImage = new RectangleF(rcFrame.Right - xbtn.FrameBackImage.Width,
                                                         rcFrame.Bottom - xbtn.FrameBackImage.Height,
                                                         xbtn.FrameBackImage.Width,
                                                         xbtn.FrameBackImage.Height
                                                         );
                                g.DrawImage(xbtn.FrameBackImage, rcImage);
                                lFrameImageWidth = xbtn.FrameBackImage.Height;
                            }
                            // draw caption / description:
                            g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                            g.DrawString(xbtn.HolderButtonCaption,
                                         xbtn.HolderButtonCaptionFont,
                                         new SolidBrush(xbtn.HolderButtonCaptionColor),
                                         rcFrame.Left + 2,
                                         rcIcon.Bottom + 4
                                         );

                            StringFormat sf = new StringFormat();
                            sf.Alignment     = StringAlignment.Near;
                            sf.LineAlignment = StringAlignment.Near;
                            sf.Trimming      = StringTrimming.EllipsisCharacter;
                            sf.FormatFlags   = StringFormatFlags.LineLimit;

                            float fCaptionWidth = g.MeasureString(xbtn.HolderButtonCaption, xbtn.HolderButtonCaptionFont).Height;

                            RectangleF rcDescription = new RectangleF(rcFrame.Left + 2,
                                                                      rcIcon.Bottom + fCaptionWidth,
                                                                      rcFrame.Width,
                                                                      rcFrame.Height - lFrameImageWidth
                                                                      );
                            g.DrawString(xbtn.HolderButtonDescription,
                                         xbtn.HolderButtonDescriptionFont,
                                         new SolidBrush(xbtn.HolderButtonDescriptionColor),
                                         rcDescription,
                                         sf
                                         );
                        }
                    }

                    // draw button:
                    g.DrawImage(xbtn.ButtonImage, rcIcon);

                    xbtn.ButtonRectangle = rcIcon;

                    // update position:
                    lX += rcIcon.Width + 2;
                }
            }
        }