示例#1
0
        public override void PaintCaptionBackground(FormCaptionRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            Rendering.Office2007FormStateColorTable formct = m_ColorTable.Form.Active;
            System.Windows.Forms.Form form = e.Form;
            bool drawBottomBorder = false;
            if (form != null && form is RibbonForm)
            {
                if(!((RibbonForm)form).NonClientActive)
                    formct = m_ColorTable.Form.Inactive;
            }
            else if (form != null && (form != System.Windows.Forms.Form.ActiveForm && form.MdiParent == null ||
                form.MdiParent != null && form.MdiParent.ActiveMdiChild != form))
                formct = m_ColorTable.Form.Inactive;
            if (form is OfficeForm) drawBottomBorder = true;

            Rectangle captionRect = e.Bounds;

            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;
            // Top Part
            Rectangle topCaptionPart = new Rectangle(captionRect.X, captionRect.Y, captionRect.Width, (int)(captionRect.Height * .3));
            DisplayHelp.FillRectangle(g, topCaptionPart, formct.CaptionTopBackground);
            Rectangle bottomCaptionPart = new Rectangle(captionRect.X, topCaptionPart.Bottom, captionRect.Width, captionRect.Height - topCaptionPart.Height);
            DisplayHelp.FillRectangle(g, bottomCaptionPart, formct.CaptionBottomBackground);
            if (drawBottomBorder && formct.CaptionBottomBorder != null && formct.CaptionBottomBorder.Length > 0)
            {
                int lines = formct.CaptionBottomBorder.Length;
                for (int i = 0; i < lines; i++)
                {
                    DisplayHelp.DrawLine(g, captionRect.X, captionRect.Bottom - lines + i, captionRect.Right, captionRect.Bottom - lines + i, formct.CaptionBottomBorder[i], 1);
                }
            }
            g.SmoothingMode = sm;
        }
示例#2
0
 public abstract void PaintCaptionBackground(FormCaptionRendererEventArgs e);