public override void Paint(ShapePaintInfo p) { System.Drawing.Rectangle bounds = this.GetBounds(p.Bounds); Graphics g = p.Graphics; PaintFill(g, bounds); PaintBorder(g, bounds); base.Paint(p); }
public override void Paint(ShapePaintInfo p) { if(m_Path == null) return; System.Drawing.Rectangle bounds = this.GetBounds(p.Bounds); Graphics g = p.Graphics; if (m_Fill != null) PaintFill(g, bounds); if (m_Border != null) PaintBorder(g, bounds); base.Paint(p); }
/// <summary> /// Paints the shape on canvas. If overriden base implementation must be called to paint any child shapes. /// </summary> /// <param name="p">Shape paint information.</param> public virtual void Paint(ShapePaintInfo p) { if (m_Children != null && m_Children.Count > 0) { System.Drawing.Rectangle originalBounds = p.Bounds; System.Drawing.Rectangle bounds = new System.Drawing.Rectangle(this.GetLocation(p.Bounds), this.GetSize(p.Bounds)); if (m_Padding != null) { bounds.Width -= m_Padding.HorizontalPadding; bounds.Height -= m_Padding.VerticalPadding; bounds.X += m_Padding.Left; bounds.Y += m_Padding.Top; } p.Bounds = bounds; Region clip = ClipChildren(p.Graphics, bounds); if (m_SetChildClip && p.Graphics.Clip!=null) { p.ChildContentClip = p.Graphics.Clip as Region; } foreach (Shape shape in m_Children) { shape.Paint(p); } if (p.ChildContentClip != null) { p.ChildContentClip.Dispose(); p.ChildContentClip = null; } if (clip != null) { p.Graphics.Clip = clip; clip.Dispose(); } else p.Graphics.ResetClip(); p.Bounds = originalBounds; if (clip != null) clip.Dispose(); } }
public override void Paint(ShapePaintInfo p) { System.Drawing.Point start = GetLocation(p.Bounds, m_StartPoint); System.Drawing.Point end = GetLocation(p.Bounds, m_EndPoint); Graphics g = p.Graphics; if (m_Border.Color2.IsEmpty) { if (!m_Border.Color1.IsEmpty) { DisplayHelp.DrawLine(g, start, end, m_Border.Color1, m_Border.Width); } } else { DisplayHelp.DrawGradientLine(g, start, end, m_Border.Color1, m_Border.Color2, m_Border.GradientAngle, m_Border.Width); } base.Paint(p); }
public override void PaintDialogLauncher(RibbonBarRendererEventArgs e) { Rectangle r = e.Bounds; Graphics g = e.Graphics; bool rightToLeft = (e.RibbonBar.RightToLeft == System.Windows.Forms.RightToLeft.Yes); Office2007DialogLauncherStateColorTable c = GetColorTable(e); if (!c.TopBackground.IsEmpty && !c.BottomBackground.IsEmpty) { Presentation.Rectangle pr = new Presentation.Rectangle( new Presentation.ShapeBorder(c.OuterBorder), new Presentation.ShapeFill(c.TopBackground)); pr.Padding = new Presentation.PaddingInfo(1, 1, 1, 1); Presentation.Rectangle prb = new Presentation.Rectangle(new Presentation.ShapeFill(c.BottomBackground)); prb.Size.Height = r.Height / 2; pr.Children.Add(prb); prb = new Presentation.Rectangle(new Presentation.ShapeBorder(c.InnerBorder)); pr.Children.Add(prb); Presentation.ShapePaintInfo pi = new Presentation.ShapePaintInfo(g, r); pr.Paint(pi); } Size size = new Size(8, 8); // Get final dialog launcher bounds if (rightToLeft) r = new Rectangle(r.X + (r.Width - size.Width) / 2, r.Y + (r.Height - size.Height) / 2, size.Width, size.Height); else r = new Rectangle(r.X + (r.Width - size.Width)/2, r.Y + (r.Height - size.Height) / 2, size.Width, size.Height); SmoothingMode sm = g.SmoothingMode; g.SmoothingMode = SmoothingMode.Default; // Create the dialog launcher shape Presentation.ShapeBorder border = new Presentation.ShapeBorder(c.DialogLauncherShade, 1); Presentation.ShapeFill fill = new Presentation.ShapeFill(c.DialogLauncherShade); Presentation.Shape shape = new Presentation.Shape(); // Horizontal line Presentation.Line line = new Presentation.Line(new Presentation.Location(), new Presentation.Location(6, 0), border); shape.Children.Add(line); // Vertical line line = new Presentation.Line(new Presentation.Location(), new Presentation.Location(0, 6), border); shape.Children.Add(line); Presentation.Rectangle rect = new Presentation.Rectangle(); rect.Fill = fill; rect.Location.X = 5; rect.Location.Y = 5; rect.Size.Width = 3; rect.Size.Height = 3; shape.Children.Add(rect); // Arrow line vertical line = new Presentation.Line(new Presentation.Location(7, 4), new Presentation.Location(7, 7), border); shape.Children.Add(line); // Arrow line horizontal line = new Presentation.Line(new Presentation.Location(4, 7), new Presentation.Location(7, 7), border); shape.Children.Add(line); // Arrow line cross line = new Presentation.Line(new Presentation.Location(4, 4), new Presentation.Location(5, 5), border); shape.Children.Add(line); r.Offset(1, 1); Presentation.ShapePaintInfo p = new Presentation.ShapePaintInfo(g, r); shape.Paint(p); border.Color1 = c.DialogLauncher; fill.Color1 = c.DialogLauncher; r.Offset(-1, -1); p.Bounds = r; shape.Paint(p); g.SmoothingMode = sm; }