protected override void OnPaint(ChartGraphics g) { if (this.Owner.Bars == null) { return; } this.HorizontalScale.CmCalculateScale(); this.VerticalScale.CmCalculateScale(); if (this.HorizontalScale.Visible) { this.HorizontalScale.WmPaint(g); } if (VerticalScale.Visible) { this.VerticalScale.WmPaint(g); } this.Area.WmPaint(g); }
protected override void OnPaint(ChartGraphics g) { g.SelectBrush(this.Owner.BackColor); GdiFont gdiFont = g.SelectFont(this.Owner.ScaleFont); this.Owner.Area.SelectGridPen(g); g.SetTextColor(this.Owner.ForeColor); for (int i = 0; i < _gridLines.Count; i++) { GridLine gl = _gridLines[i]; g.DrawLine(gl.X, 0, gl.X, 2); g.TextOut(gl.Desc, gl.X, 3); } //for (int i = 0; i < _viewCountBar; i++) { // int x = i * this.DeltaX; // int barindex = i + this.Position; // if (Multiple(x, 32)) { // //if (this.HorizontalScaleVisible && this.ChartManager.Bars != null && barindex < barcount) { // // string sc = ""; // // DateTime dtm = this.ChartManager.Bars[barindex].Time; // // if (l) { // // sc = dtm.ToString("d MMM yyyy"); // // l = false; // // } else // // sc = dtm.ToString("d MMM ") + dtm.ToShortTimeString(); // // ghscale.DrawLine(_borderPen, _map[i], 0, _map[i], 2); // // ghscale.DrawString(sc, Manager.Style.ScaleFont, _scaleForeBrush, _map[i], 2); // //} // } //} }
private void DrawGridLine(ChartGraphics g, Color color, int x1, int y1, int x2, int y2) { int num = 0; IntPtr hdc = g.HDC; if (x1 == x2) { int l = y2 - y1; while (num < l) { Win32.SetPixel(hdc, x1, num + y1, color); num += 4; } } else if (y1 == y2) { int l = x2 - x1; while (num < l) { Win32.SetPixel(hdc, num + x1, y1, color); num += 4; } } }
protected abstract void OnPaint(ChartGraphics g);
protected virtual void OnPaint(ChartGraphics g) { }
public ChartPaintEventArgs(ChartGraphics g) { _g = g; }
internal void WmPaint(ChartGraphics g) { this.OnPaint(g); }