/// <summary>
        /// Draws the orb button in pressed state
        /// </summary>
        /// <param name="e"></param>
        /// <param name="button"></param>
        public void DrawOrbPressed(RibbonRenderEventArgs e)
        {
            //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007 || e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                using (GraphicsPath path = RoundRectangle(e.ClipRectangle, 2, Corners.North))
                {
                    e.Graphics.FillPath(new SolidBrush(ColorTable.ButtonPressedGlossySouth), path);

                    //Border
                    using (Pen p = new Pen(ColorTable.ButtonPressedBorderOut))
                    {
                        e.Graphics.DrawPath(p, path);
                    }

                    //Inner border
                    Rectangle innerR = Rectangle.FromLTRB(e.ClipRectangle.Left + 1, e.ClipRectangle.Top + 1, e.ClipRectangle.Right - 1, e.ClipRectangle.Bottom);

                    using (GraphicsPath inpath = RoundRectangle(innerR, 2, Corners.North))
                    {
                        using (Pen p = new Pen(ColorTable.ButtonPressedBorderIn))
                        {
                            e.Graphics.DrawPath(p, inpath);
                        }
                    }

                    Color north = ColorTable.ButtonPressedGlossyNorth;
                    Color south = ColorTable.ButtonPressedGlossySouth;

                    int intCenter = e.ClipRectangle.Height / 2;
                    Rectangle rec = Rectangle.FromLTRB(e.ClipRectangle.Left + 1, e.ClipRectangle.Top + intCenter, e.ClipRectangle.Right - 2, e.ClipRectangle.Bottom - 1);

                    using (LinearGradientBrush b = new LinearGradientBrush(new Point(0, e.ClipRectangle.Top + intCenter), new Point(0, e.ClipRectangle.Bottom), north, south))
                    {
                        b.WrapMode = WrapMode.TileFlipXY;
                        e.Graphics.FillRectangle(b, rec);
                    }
                }
            }
            else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
				//Interior shading and highlight
				using(LinearGradientBrush b=new LinearGradientBrush(e.ClipRectangle, Color.FromArgb(255, ColorTable.OrbButtonSelected_2013), Color.FromArgb(150, ColorTable.OrbButtonSelected_2013), 90))
				{

					Blend blend=new Blend(3);
					blend.Factors=new float[] { 0.0f, 0.6f, 1.0f };
					blend.Positions=new float[] { 0.0f, 0.5f, 1.0f };

					b.Blend=blend;

					e.Graphics.FillRectangle(b, e.ClipRectangle);
				}

				//Tab border
				using(Pen p=new Pen(ColorTable.OrbButtonSelected_2013))
				{
					SmoothingMode sm=e.Graphics.SmoothingMode;
					e.Graphics.SmoothingMode=SmoothingMode.AntiAlias;
					e.Graphics.DrawRectangle(p, e.ClipRectangle);
					e.Graphics.SmoothingMode=sm;
				}
            }
        }
コード例 #2
0
        private void DrawCaptionBarText(Rectangle captionBar, RibbonRenderEventArgs e)
        {
            Form f = e.Ribbon.FindForm();

            if (f == null)
                return;

            StringFormat sf = new StringFormat(); sf.LineAlignment = sf.Alignment = StringAlignment.Center;
            sf.Trimming = StringTrimming.EllipsisCharacter; sf.FormatFlags |= StringFormatFlags.NoWrap;
            Font ft = new Font(SystemFonts.CaptionFont, FontStyle.Regular);

            if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
            {
            WinApi.DrawTextOnGlass(e.Graphics, f.Text, SystemFonts.CaptionFont, captionBar, 10);
            }
            else if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaCustomDrawn)
            {
                TextRenderer.DrawText(e.Graphics, f.Text, ft, captionBar, ColorTable.FormBorder);

            }
            //Console.WriteLine("capt " + DateTime.Now.Millisecond + e.ClipRectangle.ToString());
            //WinApi.FillForGlass(e.Graphics, captionBar);
            //WinApi.DrawTextOnGlass(e.Ribbon.Handle, f.Text, SystemFonts.CaptionFont, captionBar, 10);
        }
        private void DrawCaptionBarText(Rectangle captionBar, RibbonRenderEventArgs e)
        {
            Form f = e.Ribbon.FindForm();

            if (f == null)
                return;

            Font ft = new Font(SystemFonts.CaptionFont, FontStyle.Regular);
            if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
            {
                WinApi.DrawTextOnGlass(e.Graphics, f.Text, SystemFonts.CaptionFont, captionBar, 10);
            }
            else if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaCustomDrawn)
            {
                using (StringFormat sf = StringFormatFactory.CenterNoWrapTrimEllipsis())
                using (Brush b = new SolidBrush(ColorTable.FormBorder))
                {
                    e.Graphics.DrawString(f.Text, ft, b, captionBar, sf);
                }
            }
            //Console.WriteLine("capt " + DateTime.Now.Millisecond + e.ClipRectangle.ToString());
            //WinApi.FillForGlass(e.Graphics, captionBar);
            //WinApi.DrawTextOnGlass(e.Ribbon.Handle, f.Text, SystemFonts.CaptionFont, captionBar, 10);
        }
コード例 #4
0
 /// <summary>
 /// Renders the background of the QuickAccess toolbar
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderRibbonQuickAccessToolbarBackground(RibbonRenderEventArgs e)
 {
 }
コード例 #5
0
 public override void OnRenderRibbonBackground(RibbonRenderEventArgs e)
 {
     e.Graphics.Clear(ColorTable.RibbonBackground);
 }
        public override void OnRenderRibbonOrb(RibbonRenderEventArgs e)
        {
            if (e.Ribbon.OrbVisible)
            {
                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
                {
                    if (e.Ribbon.CaptionBarVisible)
                        DrawOrb(e.Graphics, e.Ribbon.OrbBounds, e.Ribbon.OrbImage, e.Ribbon.OrbSelected, e.Ribbon.OrbPressed);
                }
                else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010 || e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013) //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
                {
                    //draw 2010 style
                    RibbonRenderEventArgs args = new RibbonRenderEventArgs(e.Ribbon, e.Graphics, e.Ribbon.OrbBounds);
                    if (e.Ribbon.OrbPressed)
                    {
                        DrawOrbPressed(args);
                    }
                    else if (e.Ribbon.OrbSelected)
                    {
                        DrawOrbSelected(args);
                    }
                    else
                    {
                        DrawOrbNormal(args);
                    }


                    if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
                    {
                        if (e.Ribbon.OrbText != string.Empty)
                        {
                            using (StringFormat sf = StringFormatFactory.CenterNoWrapTrimEllipsis())
                            using (Brush b = new SolidBrush(ColorTable.OrbButtonText))
                            {
								if(e.Ribbon.AltPressed) sf.HotkeyPrefix=Drawing.Text.HotkeyPrefix.Show;
								else sf.HotkeyPrefix=Drawing.Text.HotkeyPrefix.Hide;
                                e.Graphics.DrawString(FormatText(e.Ribbon.OrbText, e.Ribbon.AltKey, e.Ribbon.AltPressed), e.Ribbon.RibbonTabFont, b, e.Ribbon.OrbBounds, sf);
                            }
                        }
                    }
                    else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
                    {
                        if (e.Ribbon.OrbText != string.Empty)
                        {
                            using (StringFormat sf = StringFormatFactory.CenterNoWrapTrimEllipsis())
                            using (Brush b = new SolidBrush(ColorTable.OrbButtonText_2013))
                            {
								if(e.Ribbon.AltPressed) sf.HotkeyPrefix=Drawing.Text.HotkeyPrefix.Show;
								else sf.HotkeyPrefix=Drawing.Text.HotkeyPrefix.Hide;
                                e.Graphics.DrawString(FormatText(e.Ribbon.OrbText, e.Ribbon.AltKey, e.Ribbon.AltPressed), e.Ribbon.RibbonTabFont, b, e.Ribbon.OrbBounds, sf);
                            }
                        }
                    }

                    if (e.Ribbon.OrbImage != null)
                    {
                        Rectangle irect = new Rectangle(Point.Empty, e.Ribbon.OrbImage.Size);
                        irect.X = e.Ribbon.OrbBounds.X + (e.Ribbon.OrbBounds.Width - irect.Width) / 2;
                        irect.Y = e.Ribbon.OrbBounds.Y + (e.Ribbon.OrbBounds.Height - irect.Height) / 2;
                        e.Graphics.DrawImage(e.Ribbon.OrbImage, irect);
                    }
                }
            }
        }
コード例 #7
0
 /// <summary>
 /// Renders the Ribbon's caption bar
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderRibbonCaptionBar(RibbonRenderEventArgs e)
 {
 }
コード例 #8
0
 /// <summary>
 /// Renders the orb of the ribbon
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderRibbonOrb(RibbonRenderEventArgs e)
 {
 }
コード例 #9
0
 /// <summary>
 /// Renders the background of the QuickAccess toolbar
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderRibbonQuickAccessToolbarBackground(RibbonRenderEventArgs e)
 {
 }
コード例 #10
0
 /// <summary>
 /// Renders the Ribbon's background
 /// </summary>
 public virtual void OnRenderRibbonBackground(RibbonRenderEventArgs e)
 {
 }
コード例 #11
0
 /// <summary>
 /// Renders the Ribbon's caption bar
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderRibbonCaptionBar(RibbonRenderEventArgs e)
 {
 }
コード例 #12
0
        public void DrawCheckBox(RibbonRenderEventArgs e, RibbonCheckBox checkbox)
        {

            Rectangle checkboxBorder = new Rectangle(checkbox.Bounds.X + 2, checkbox.Bounds.Y + 2, 13, 13);

			if (checkbox.CheckedState == CheckState.Unchecked) {
				if (checkbox.Selected) {
					e.Graphics.DrawImage(Properties.Resources.checkbox_uh, checkboxBorder.Location);
				} else {
					e.Graphics.DrawImage(Properties.Resources.checkbox_un, checkboxBorder.Location);
				}
			} else if (checkbox.CheckedState == CheckState.Checked) {
				if (checkbox.Pressed) {
					e.Graphics.DrawImage(Properties.Resources.checkbox_cd, checkboxBorder.Location);
				} else if (checkbox.Selected) {
					e.Graphics.DrawImage(Properties.Resources.checkbox_ch, checkboxBorder.Location);
				} else {
					e.Graphics.DrawImage(Properties.Resources.checkbox_cn, checkboxBorder.Location);
				}
			}

			Rectangle textArea = Rectangle.FromLTRB(checkbox.Bounds.Left + 2 + 15, checkbox.Bounds.Top + 2,
				checkbox.Bounds.Right - 2, checkbox.Bounds.Bottom - 2);

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

            using (Brush b = new SolidBrush(GetTextColor(true, ColorTable.PanelText)))
            {
                e.Graphics.DrawString(checkbox.Text, e.Ribbon.Font, b, textArea, sf);
            }

            //g.FillRectangle(Brushes.Black, checkbox.Bounds);
        }
コード例 #13
0
 public override void OnRenderRibbonOrb(RibbonRenderEventArgs e)
 {
     if (e.Ribbon.OrbVisible)
         DrawOrb(e.Graphics, e.Ribbon.OrbBounds, e.Ribbon.OrbImage, e.Ribbon.OrbSelected, e.Ribbon.OrbPressed);
 }
コード例 #14
0
        private void DrawCaptionBarText(Rectangle captionBar, RibbonRenderEventArgs e)
        {
            Form f = e.Ribbon.FindForm();

            if (f == null) 
                return;

            StringFormat sf = new StringFormat(); sf.LineAlignment = sf.Alignment = StringAlignment.Center;
            sf.Trimming = StringTrimming.EllipsisCharacter; sf.FormatFlags |= StringFormatFlags.NoWrap;
            Font ft = new Font(SystemFonts.CaptionFont, FontStyle.Regular);


            if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
            {
                using (GraphicsPath path = new GraphicsPath())
                {
                    path.AddString(f.Text, ft.FontFamily, (int)ft.Style, ft.SizeInPoints + 3, captionBar, sf);

                    if (f.WindowState != FormWindowState.Maximized)
                    {
                        using (Pen p = new Pen(Color.FromArgb(90, Color.White), 4))
                        {
                            e.Graphics.DrawPath(p, path);
                        }
                    }

                    e.Graphics.FillPath(f.WindowState == FormWindowState.Maximized ? Brushes.White : Brushes.Black, path);
                }
            }
            else if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaCustomDrawn)
            {
                TextRenderer.DrawText(e.Graphics, f.Text, ft, captionBar, ColorTable.FormBorder);
                
            }
            //Console.WriteLine("capt " + DateTime.Now.Millisecond + e.ClipRectangle.ToString());
            //WinApi.FillForGlass(e.Graphics, captionBar);
            //WinApi.DrawTextOnGlass(e.Ribbon.Handle, f.Text, SystemFonts.CaptionFont, captionBar, 10);
        }
 public override void OnRenderRibbonCaptionBar(RibbonRenderEventArgs e)
 {
     if (e.Ribbon.CaptionBarVisible)
     {
         Rectangle captionBar = new Rectangle(0, 0, e.Ribbon.Width, e.Ribbon.CaptionBarSize);
         if (!(e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass && RibbonDesigner.Current == null))
         {
             //DrawCaptionBarBackground(captionBar, e.Graphics);
         }
         DrawCaptionBarText(e.Ribbon.CaptionTextBounds, e);
     }
 }
コード例 #16
0
        /// <summary>
        /// Draws the orb button in pressed state
        /// </summary>
        /// <param name="e"></param>
        /// <param name="button"></param>
        public void DrawOrbPressed(RibbonRenderEventArgs e)
        {
            //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                using (GraphicsPath path = RoundRectangle(e.ClipRectangle, 2, Corners.North))
                {
                    e.Graphics.FillPath(new SolidBrush(Theme.ColorTable.ButtonPressedGlossySouth), path);

                    //Border
                    using (Pen p = new Pen(Theme.ColorTable.ButtonPressedBorderOut))
                    {
                        e.Graphics.DrawPath(p, path);
                    }

                    //Inner border
                    Rectangle innerR = Rectangle.FromLTRB(e.ClipRectangle.Left + 1, e.ClipRectangle.Top + 1, e.ClipRectangle.Right - 1, e.ClipRectangle.Bottom);

                    using (GraphicsPath inpath = RoundRectangle(innerR, 2, Corners.North))
                    {
                        using (Pen p = new Pen(Theme.ColorTable.ButtonPressedBorderIn))
                        {
                            e.Graphics.DrawPath(p, inpath);
                        }
                    }

                    Color north = Theme.ColorTable.ButtonPressedGlossyNorth;
                    Color south = Theme.ColorTable.ButtonPressedGlossySouth;

                    int intCenter = e.ClipRectangle.Height / 2;
                    Rectangle rec = Rectangle.FromLTRB(e.ClipRectangle.Left + 1, e.ClipRectangle.Top + intCenter, e.ClipRectangle.Right - 2, e.ClipRectangle.Bottom - 1);

                    using (LinearGradientBrush b = new LinearGradientBrush(new Point(0, e.ClipRectangle.Top + intCenter), new Point(0, e.ClipRectangle.Bottom), north, south))
                    {
                        b.WrapMode = WrapMode.TileFlipXY;
                        e.Graphics.FillRectangle(b, rec);
                    }
                }
            }
            else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                using (GraphicsPath path = FlatRectangle(e.ClipRectangle))
                {
                    e.Graphics.FillPath(new SolidBrush(Theme.ColorTable.OrbButtonPressed_2013), path);
                }
            }
        }
        public override void OnRenderRibbonQuickAccessToolbarBackground(RibbonRenderEventArgs e)
        {
            /// a-----b    a-----b
            ///  z    |   z       |
            ///   c---d    c-----d
            Rectangle bounds = e.Ribbon.QuickAccessToolbar.Bounds;
            Padding padding = e.Ribbon.QuickAccessToolbar.Padding;
            Padding margin = e.Ribbon.QuickAccessToolbar.Margin;
            Point a = new Point(bounds.Left - (e.Ribbon.OrbVisible ? margin.Left : 0), bounds.Top);
            Point b = new Point(bounds.Right + padding.Right, bounds.Top);
            Point c = new Point(bounds.Left, bounds.Bottom);
            Point d = new Point(b.X, c.Y);
            Point z = new Point(c.X - 2, a.Y + bounds.Height / 2 - 1);

            bool aero = e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass && RibbonDesigner.Current == null;
            if (e.Ribbon.RightToLeft == RightToLeft.Yes)
            {
                ///   a-----b    a-----b
                ///  |     z    |       z
                ///   c---d      c-----d
                a = new Point(bounds.Left + padding.Left, bounds.Top);
                b = new Point(bounds.Right + (e.Ribbon.OrbVisible ? margin.Right : 0), bounds.Top);
                c = new Point(a.X, bounds.Bottom);
                d = new Point(bounds.Right, bounds.Bottom);
                z = new Point(d.X + 2, b.Y + (bounds.Height / 2) - 1);
            }

            using (GraphicsPath path = CreateQuickAccessPath(a, b, c, d, z, bounds, 0, 0, e.Ribbon))
            {
                if (!aero)
                {
                    using (Pen p = new Pen(ColorTable.QuickAccessBorderLight, 3))
                    {
                        e.Graphics.DrawPath(p, path);
                    }
                }
                using (Pen p = new Pen(ColorTable.QuickAccessBorderDark, 1))
                {
                    if (aero) p.Color = Color.FromArgb(150, 150, 150);
                    e.Graphics.DrawPath(p, path);
                }
                if (e.Ribbon.RightToLeft == RightToLeft.Yes)
                {
                    b = a;
                    d = c;
                }
                if (!aero)
                {
                    using (LinearGradientBrush br = new LinearGradientBrush(
                        b, d, Color.FromArgb(150, ColorTable.QuickAccessUpper), Color.FromArgb(150, ColorTable.QuickAccessLower)
                        ))
                    {
                        e.Graphics.FillPath(br, path);
                    }
                }
                else
                {
                    using (LinearGradientBrush br = new LinearGradientBrush(
                         b, d,
                         Color.FromArgb(66, RibbonProfesionalRendererColorTable.ToGray(ColorTable.QuickAccessUpper)),
                         Color.FromArgb(66, RibbonProfesionalRendererColorTable.ToGray(ColorTable.QuickAccessLower))
                         ))
                    {
                        e.Graphics.FillPath(br, path);
                    }
                }
            }
        }
コード例 #18
0
        /// <summary>
        /// Draws the orb button in pressed state
        /// </summary>
        /// <param name="e"></param>
        /// <param name="button"></param>
        public void DrawOrbPressed(RibbonRenderEventArgs e)
        {
            using (GraphicsPath path = RoundRectangle(e.ClipRectangle, 2, Corners.North))
            {
                e.Graphics.FillPath(new SolidBrush(ColorTable.ButtonPressedGlossySouth), path);

                //Border
                using (Pen p = new Pen(ColorTable.ButtonPressedBorderOut))
                {
                    e.Graphics.DrawPath(p, path);
                }

                //Inner border
                Rectangle innerR = Rectangle.FromLTRB(
                     e.ClipRectangle.Left + 1,
                     e.ClipRectangle.Top + 1,
                     e.ClipRectangle.Right - 1,
                     e.ClipRectangle.Bottom);
                using (GraphicsPath inpath = RoundRectangle(innerR, 2, Corners.North))
                {
                    using (Pen p = new Pen(ColorTable.ButtonPressedBorderIn))
                    {
                        e.Graphics.DrawPath(p, inpath);
                    }
                }

                Color north = ColorTable.ButtonPressedGlossyNorth;
                Color south = ColorTable.ButtonPressedGlossySouth;

                int intCenter = e.ClipRectangle.Height / 2;
                Rectangle rec = Rectangle.FromLTRB(e.ClipRectangle.Left + 1, e.ClipRectangle.Top + intCenter, e.ClipRectangle.Right - 2, e.ClipRectangle.Bottom - 1);

                using (LinearGradientBrush b = new LinearGradientBrush(
                     new Point(0, e.ClipRectangle.Top + intCenter),
                     new Point(0, e.ClipRectangle.Bottom), north, south))
                {
                    b.WrapMode = WrapMode.TileFlipXY;
                    e.Graphics.FillRectangle(b, rec);
                }
            }
        }
 public override void OnRenderRibbonBackground(RibbonRenderEventArgs e)
 {
     if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
     {
         e.Graphics.Clear(ColorTable.RibbonBackground);
         if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
         {
             if (!e.Ribbon.IsDesignMode())
                 WinApi.FillForGlass(e.Graphics, new Rectangle(0, 0, e.Ribbon.Width, e.Ribbon.CaptionBarSize + 1));
         }
     }
     if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
     {
         e.Graphics.Clear(ColorTable.RibbonBackground);
         if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
         {
             WinApi.FillForGlass(e.Graphics, new Rectangle(0, 0, e.Ribbon.Width, e.Ribbon.CaptionBarSize + e.Ribbon.TabsMargin.Top));
         }
     }
     if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
     {
         e.Graphics.Clear(ColorTable.RibbonBackground_2013);
         if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
         {
             WinApi.FillForGlass(e.Graphics, new Rectangle(0, 0, e.Ribbon.Width, e.Ribbon.CaptionBarSize  + e.Ribbon.TabsMargin.Top));
         }
     }
 }
コード例 #20
0
        public override void OnRenderRibbonBackground(RibbonRenderEventArgs e)
        {
            //if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
            //{
            //    e.Graphics.Clear(Color.Transparent);
            //    SmoothingMode sbuff = e.Graphics.SmoothingMode;
            //    e.Graphics.SmoothingMode = SmoothingMode.None;
            //    e.Graphics.FillRectangle(new SolidBrush(ColorTable.RibbonBackground), new Rectangle(0, e.Ribbon.CaptionBarSize + 1, e.Ribbon.Width, e.Ribbon.Height));
            //    e.Graphics.SmoothingMode = sbuff;
            //}
            //else
            //{
            //   e.Graphics.Clear(ColorTable.RibbonBackground);
            //}

            e.Graphics.Clear(ColorTable.RibbonBackground);

            if (e.Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaGlass)
            {
                WinApi.FillForGlass(e.Graphics, new Rectangle(0, 0, e.Ribbon.Width, e.Ribbon.CaptionBarSize + 1));
            }
        }
コード例 #21
0
 /// <summary>
 /// Renders the orb of the ribbon
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderRibbonOrb(RibbonRenderEventArgs e)
 {
 }
コード例 #22
0
        public override void OnRenderRibbonOrb(RibbonRenderEventArgs e)
        {
            if (e.Ribbon.OrbVisible)
            {
                if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007)
                {
                    if (e.Ribbon.CaptionBarVisible)
                        DrawOrb(e.Graphics, e.Ribbon.OrbBounds, e.Ribbon.OrbImage, e.Ribbon.OrbSelected, e.Ribbon.OrbPressed);
                }
                else
                {
                    //draw 2010 style
                    RibbonRenderEventArgs args = new RibbonRenderEventArgs(e.Ribbon, e.Graphics, e.Ribbon.OrbBounds);
                    if (e.Ribbon.OrbPressed)
                    {
                        DrawOrbPressed(args);
                    }
                    else if (e.Ribbon.OrbSelected)
                    {
                        DrawOrbNormal(args);
                    }
                    else
                    {
                        DrawOrbNormal(args);
                    }

                    if (e.Ribbon.OrbText != string.Empty)
                        TextRenderer.DrawText(e.Graphics, e.Ribbon.OrbText, e.Ribbon.Font, e.Ribbon.OrbBounds, ColorTable.OrbButtonText);

                    if (e.Ribbon.OrbImage != null)
                    {
                        Rectangle irect = new Rectangle(Point.Empty, e.Ribbon.OrbImage.Size);
                        irect.X = e.Ribbon.OrbBounds.X + (e.Ribbon.OrbBounds.Width - irect.Width) / 2;
                        irect.Y = e.Ribbon.OrbBounds.Y + (e.Ribbon.OrbBounds.Height - irect.Height) / 2;
                        e.Graphics.DrawImage(e.Ribbon.OrbImage, irect);
                    }
                }
            }
        }
コード例 #23
0
 /// <summary>
 /// Renders the Ribbon's background
 /// </summary>
 public virtual void OnRenderRibbonBackground(RibbonRenderEventArgs e)
 {
 }
コード例 #24
0
        /// <summary>
        /// Draws the orb button in a normal state
        /// </summary>
        /// <param name="e"></param>
        /// <param name="button"></param>
        public void DrawOrbNormal(RibbonRenderEventArgs e)
        {
            //Michael Spradlin - 05/03/2013 Office 2013 Style Changes
            if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007 || e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
            {
                using (GraphicsPath path = RoundRectangle(e.ClipRectangle, 2, Corners.North))
                {
                    e.Graphics.FillPath(new SolidBrush(ColorTable.OrbButtonBackground), path);

                    //Border
                    using (Pen pOut = new Pen(ColorTable.OrbButtonBorderDark))
                    {
                        e.Graphics.DrawPath(pOut, path);
                    }

                    //Inner border
                    Rectangle innerR = Rectangle.FromLTRB(e.ClipRectangle.Left + 1, e.ClipRectangle.Top + 1, e.ClipRectangle.Right - 1, e.ClipRectangle.Bottom);

                    using (GraphicsPath inpath = RoundRectangle(innerR, 2, Corners.North))
                    {
                        using (Pen pIn = new Pen(ColorTable.OrbButtonMedium))
                        {
                            e.Graphics.DrawPath(pIn, inpath);
                        }
                    }

                    int intCenter = e.ClipRectangle.Height / 2;

                    Rectangle rec = Rectangle.FromLTRB(e.ClipRectangle.Left + 1, e.ClipRectangle.Top + intCenter, e.ClipRectangle.Right - 2, e.ClipRectangle.Bottom - 1);

                    Color north = ColorTable.OrbButtonDark;
                    Color south = ColorTable.OrbButtonLight;

                    using (LinearGradientBrush b = new LinearGradientBrush(new Point(0, e.ClipRectangle.Top + intCenter), new Point(0, e.ClipRectangle.Bottom), north, south))
                    {
                        b.WrapMode = WrapMode.TileFlipXY;
                        e.Graphics.FillRectangle(b, rec);
                    }
                }
            }
            else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
            {
                using (GraphicsPath path = FlatRectangle(e.ClipRectangle))
                {
                    SmoothingMode smbuff = e.Graphics.SmoothingMode;
                    e.Graphics.SmoothingMode = SmoothingMode.None;
                    e.Graphics.FillPath(new SolidBrush(ColorTable.OrbButton_2013), path);
                    e.Graphics.SmoothingMode = smbuff;
                }
            }
        }