public DrawMarkerData(ChControl cc, DecorateMarkers dm) { this.cc = cc; this.dm = dm; this.Children.Add(cc); this.cc.Parent = this; }
/// <summary> /// constructor /// </summary> /// <param name="cd">Chart Data</param> /// <param name="cc">Chart Control</param> public DrawText(ChControl cc, ChartData cd) { //Init Properties this.Title = cd.Title; this.XLabel = cd.TitleX; // this.YLabels = cd.TitlesY; this.XType = cd.AxisLabelX; this.YType = cd.AxisLabelY; if (cd.TitlesY != null && cd.TitlesY.Length == 1) { legendhorizontal = false; } //Set ChControl this.cc = cc; //Init legend ly = new DrawLegend(); //Add legend and ChControl to Children this.Children.Add(cc); this.Children.Add(ly); //Set Parents of legend and ChControl ly.Parent = this; cc.Parent = this; }
/// <summary> /// Constructor, adds prepaint handler to chart control and its children /// </summary> /// <param name="cc">Chart control</param> public DecorateChControlBase(ChControl cc) { this.cc = cc; cc.PrePaint += new PaintHandler(cc_PrePaint); cc.PostPaint += new PaintHandler(cc_PostPaint); //Add eventhandlers for PrePaint and PostPaint to all children RecursiveSearch(cc.Children); }
protected override void OnPostPaint(ChControl cc, Graphics g) { DrawGrid gr = cc as DrawGrid; if (gr != null) { foreach (PointF p in points) { DrawMarker(gr, g, p); } } }
/// <summary> /// Recursivly find the location of a ChControl refered to top ChControl parent /// </summary> /// <param name="c"></param> /// <returns></returns> Point GetParentLocation(ChControl c) { if (c.Parent == null) { return(c.Location); } else { Point p = GetParentLocation(c.Parent); Point pc = new Point(c.Location.X + p.X, c.Location.Y + p.Y); return(pc); } }
/// <summary> /// Called after the control has been drawn /// </summary> /// <param name="cc">Chart Control</param> /// <param name="g">Graphic g</param> protected abstract void OnPostPaint(ChControl cc, Graphics g);
//Call OPostPaint private void cc_PostPaint(ChControl cc, Graphics g) { OnPostPaint(cc, g); }
//Call OPrePaint private void cc_PrePaint(ChControl sender, Graphics g) { OnPrePaint(sender, g); }
/// <summary> /// Decorates the chart control /// </summary> /// <param name="cc">chart control</param> /// <param name="g">Graphics</param> protected override void OnPrePaint(ChControl cc, Graphics g) { cc.Font = font; cc.BackColor = backcolor; cc.ForeColor = forecolor; }
protected override void OnPostPaint(ChControl cc, Graphics g) { }
/// <summary> /// constructor, calls base constructor /// </summary> /// <param name="cc">Chart control</param> /// <param name="ForeColor">Foreground color</param> /// <param name="BackColor">Background color</param> /// <param name="Font">Font</param> public DecorateSkin(ChControl cc, Color ForeColor, Color BackColor, Font Font) : base(cc) { forecolor = ForeColor; backcolor = BackColor; this.font = Font; }
/// <summary> /// Add control to collection /// </summary> /// <param name="cc">Chart control</param> /// <returns>index</returns> public int Add(ChControl cc) { return(this.List.Add(cc)); }