/// <summary> /// Paint the provided rectangle. /// </summary> /// <param name="g">Graphics to use for drawing.</param> /// <param name="rect">Rectangle to be drawn.</param> /// <param name="edges">True if the edges needs to be drawn.</param> /// <param name="sender">Sender of the message..</param> public void PaintRectangle(Graphics g, Rectangle rect, bool edges, Control sender) { // If we are rendering using desktop window composition and using the Office 2010 shape // of ribbon then we need to draw the tabs area as part of the window chromw if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010)) { if (edges) { rect.X += EDGE_GAP; rect.Width -= EDGE_GAP * 2; } else if ((sender != null) && !_ribbon.MinimizedMode) { using (ViewDrawRibbonGroupsBorder border = new ViewDrawRibbonGroupsBorder(_ribbon, false, _paintDelegate)) { border.ClientRectangle = new Rectangle(-sender.Location.X, rect.Bottom - 1, _ribbon.Width, 10); using (RenderContext context = new RenderContext(_ribbon, g, rect, _ribbon.Renderer)) { border.Render(context); } } } using (LinearGradientBrush backBrush = new LinearGradientBrush(new Rectangle(rect.X, rect.Y - 1, rect.Width, rect.Height + 1), Color.Transparent, Color.White, 90f)) { backBrush.Blend = _compBlend; g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1)); } } }
/// <summary> /// Paint the provided rectangle. /// </summary> /// <param name="g">Graphics to use for drawing.</param> /// <param name="rect">Rectangle to be drawn.</param> /// <param name="edges">True if the edges needs to be drawn.</param> /// <param name="sender">Sender of the message..</param> public void PaintRectangle(Graphics g, Rectangle rect, bool edges, Control sender) { // If we are rendering using desktop window composition and using the Office 2010 shape // of ribbon then we need to draw the tabs area as part of the window chrome // Not for 2013 if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013 || _ribbon.RibbonShape == PaletteRibbonShape.Office365)) { if (edges) { rect.X += EDGE_GAP; rect.Width -= EDGE_GAP * 2; } else if ((sender != null) && !_ribbon.MinimizedMode) { using (ViewDrawRibbonGroupsBorder border = new ViewDrawRibbonGroupsBorder(_ribbon, false, _paintDelegate)) { border.ClientRectangle = new Rectangle(-sender.Location.X, rect.Bottom - 1, _ribbon.Width, 10); using (RenderContext context = new RenderContext(_ribbon, g, rect, _ribbon.Renderer)) { border.Render(context); } } } if (_ribbon.RibbonShape == PaletteRibbonShape.Office2010) { //Adjust Color of the gradient Color gradientColor = KryptonManager.CurrentGlobalPalette == KryptonManager.PaletteOffice2010Black ? Color.FromArgb(39, 39, 39) : Color.White; using (LinearGradientBrush backBrush = new LinearGradientBrush(new Rectangle(rect.X, rect.Y - 1, rect.Width, rect.Height + 1), Color.Transparent, gradientColor, 90f)) { backBrush.Blend = _compBlend; g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1)); } } else if (_ribbon.RibbonShape == PaletteRibbonShape.Office2013) { using (SolidBrush backBrush = new SolidBrush(Color.White)) { g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1)); } } else if (_ribbon.RibbonShape == PaletteRibbonShape.Office365) { using (SolidBrush backBrush = new SolidBrush(Color.White)) { g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1)); } } } }
/// <summary> /// Paint the provided rectangle. /// </summary> /// <param name="g">Graphics to use for drawing.</param> /// <param name="rect">Rectangle to be drawn.</param> /// <param name="edges">True if the edges needs to be drawn.</param> /// <param name="sender">Sender of the message..</param> public void PaintRectangle(Graphics g, Rectangle rect, bool edges, Control sender) { // If we are rendering using desktop window composition and using the Office 2010 shape // of ribbon then we need to draw the tabs area as part of the window chrome // Not for 2013 if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010 || _ribbon.RibbonShape == PaletteRibbonShape.Office2013)) { if (edges) { rect.X += EDGE_GAP; rect.Width -= EDGE_GAP * 2; } else if ((sender != null) && !_ribbon.MinimizedMode) { using (ViewDrawRibbonGroupsBorder border = new ViewDrawRibbonGroupsBorder(_ribbon, false, _paintDelegate)) { border.ClientRectangle = new Rectangle(-sender.Location.X, rect.Bottom - 1, _ribbon.Width, 10); using (RenderContext context = new RenderContext(_ribbon, g, rect, _ribbon.Renderer)) border.Render(context); } } if (_ribbon.RibbonShape == PaletteRibbonShape.Office2010) { //Adjust Color of the gradient Color gradientColor; if (KryptonManager.CurrentGlobalPalette == KryptonManager.PaletteOffice2010Black) { gradientColor = Color.FromArgb(39, 39, 39); } else { gradientColor = Color.White; } using (LinearGradientBrush backBrush = new LinearGradientBrush(new Rectangle(rect.X, rect.Y - 1, rect.Width, rect.Height + 1), Color.Transparent, gradientColor, 90f)) { backBrush.Blend = _compBlend; g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1)); } } else if (_ribbon.RibbonShape == PaletteRibbonShape.Office2013) { using (SolidBrush backBrush = new SolidBrush(Color.White)) { g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1)); } } } }
/// <summary> /// Paint the provided rectangle. /// </summary> /// <param name="g">Graphics to use for drawing.</param> /// <param name="rect">Rectangle to be drawn.</param> /// <param name="edges">True if the edges needs to be drawn.</param> /// <param name="sender">Sender of the message..</param> public void PaintRectangle(Graphics g, Rectangle rect, bool edges, Control sender) { // If we are rendering using desktop window composition and using the Office 2010 shape // of ribbon then we need to draw the tabs area as part of the window chromw if (DrawOnComposition && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010)) { if (edges) { rect.X += EDGE_GAP; rect.Width -= EDGE_GAP * 2; } else if ((sender != null) && !_ribbon.MinimizedMode) { using (ViewDrawRibbonGroupsBorder border = new ViewDrawRibbonGroupsBorder(_ribbon, false, _paintDelegate)) { border.ClientRectangle = new Rectangle(-sender.Location.X, rect.Bottom - 1, _ribbon.Width, 10); using (RenderContext context = new RenderContext(_ribbon, g, rect, _ribbon.Renderer)) border.Render(context); } } using (LinearGradientBrush backBrush = new LinearGradientBrush(new Rectangle(rect.X, rect.Y - 1, rect.Width, rect.Height + 1), Color.Transparent, Color.White, 90f)) { backBrush.Blend = _compBlend; g.FillRectangle(backBrush, new Rectangle(rect.X, rect.Y, rect.Width, rect.Height - 1)); } } }