///// <summary> ///// Draws ribbon bar background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you ///// do not want default rendering to occur do not call the base implementation. You can call OnRenderRibbonBarBackground method so events can occur. ///// </summary> ///// <param name="e">Provides context information.</param> //public override void DrawRibbonBarBackground(RibbonBarRendererEventArgs e) //{ // base.DrawRibbonBarBackground(e); // RibbonBarPainter painter = PainterFactory.CreateRibbonBarPainter(e.RibbonBar); // if (painter is IOffice2007Painter) // ((IOffice2007Painter)painter).ColorTable = m_ColorTable; // else if (painter is IOffice12Painter) // ((IOffice12Painter)painter).ColorTable = m_ColorTable12; // painter.PaintBackground(e); //} ///// <summary> ///// Draws ribbon bar title. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you ///// do not want default rendering to occur do not call the base implementation. You can call OnRenderRibbonBarTitle method so events can occur. ///// </summary> ///// <param name="e">Provides context information.</param> //public override void DrawRibbonBarTitle(RibbonBarRendererEventArgs e) //{ // base.DrawRibbonBarTitle(e); // RibbonBarPainter painter = PainterFactory.CreateRibbonBarPainter(e.RibbonBar); // if (painter is IOffice2007Painter) // ((IOffice2007Painter)painter).ColorTable = m_ColorTable; // else if (painter is IOffice12Painter) // ((IOffice12Painter)painter).ColorTable = m_ColorTable12; // painter.PaintTitle(e); //} #endregion #region ColorItem rendering /// <summary> /// Draws ColorItem. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderColorItem method so events can occur. /// </summary> /// <param name="e">Provides context information.</param> public override void DrawColorItem(ColorItemRendererEventArgs e) { Rendering.ColorItemPainter painter = PainterFactory.CreateColorItemPainter(e.ColorItem); if (painter is IOffice2007Painter) ((IOffice2007Painter)painter).ColorTable = m_ColorTable; painter.PaintColorItem(e); base.DrawColorItem(e); }
public abstract void PaintColorItem(ColorItemRendererEventArgs e);
/// <summary> /// Draws ColorItem. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderColorItem method so events can occur. /// </summary> /// <param name="e">Provides context information.</param> public virtual void DrawColorItem(ColorItemRendererEventArgs e) { OnRenderColorItem(e); }
public override void PaintColorItem(ColorItemRendererEventArgs e) { Graphics g = e.Graphics; ColorItem item = e.ColorItem; Rectangle r = item.Bounds; Color borderColor = m_ColorTable.ColorItem.Border; Color outerHotColor = m_ColorTable.ColorItem.MouseOverOuterBorder; Color innerHotColor = m_ColorTable.ColorItem.MouseOverInnerBorder; System.Drawing.Drawing2D.SmoothingMode sm = g.SmoothingMode; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default; Region clip = g.Clip; g.SetClip(r); Color selectedColor = Color.Empty; ColorPickerDropDown cpd = null; BaseItem parent = item.Parent; while (parent != null) { if (parent is ColorPickerDropDown) { cpd = parent as ColorPickerDropDown; break; } parent = parent.Parent; } if (cpd != null) selectedColor = cpd.SelectedColor; try { if (!item.Color.IsEmpty) { Rectangle fill = r; fill.Inflate(1, 1); DisplayHelp.FillRectangle(g, fill, item.Color, Color.Empty); } if (item.IsMouseOver || selectedColor == item.Color) { Rectangle inner = r; inner.Inflate(-1, -1); DisplayHelp.DrawRectangle(g, innerHotColor, inner); DisplayHelp.DrawRectangle(g, outerHotColor, r); } else { eColorItemBorder border = item.Border; if (border == eColorItemBorder.All) DisplayHelp.DrawRectangle(g, borderColor, r); else if (border != eColorItemBorder.None) { using (Pen pen = new Pen(borderColor)) { if ((border & eColorItemBorder.Left) == eColorItemBorder.Left) g.DrawLine(pen, r.X, r.Y, r.X, r.Bottom - 1); if ((border & eColorItemBorder.Right) == eColorItemBorder.Right) g.DrawLine(pen, r.Right - 1, r.Y, r.Right - 1, r.Bottom - 1); if ((border & eColorItemBorder.Top) == eColorItemBorder.Top) g.DrawLine(pen, r.X, r.Y, r.Right - 1, r.Y); if ((border & eColorItemBorder.Bottom) == eColorItemBorder.Bottom) g.DrawLine(pen, r.X, r.Bottom - 1, r.Right - 1, r.Bottom - 1); } } } } finally { if (clip != null) g.Clip = clip; else g.ResetClip(); } g.SmoothingMode = sm; }
/// <summary> /// Raises RenderColorItem event event. /// </summary> /// <param name="e">Provides context information.</param> protected virtual void OnRenderColorItem(ColorItemRendererEventArgs e) { if (RenderColorItem != null) RenderColorItem(this, e); }