public void DrawCursor(Graphics g, FormulaChart fc, FormulaArea Area, float X) { if (!this.LastCursorRect.IsEmpty) { fc.RestoreMemBmp(g, this.LastCursorRect); } FormulaLabel label = Area.Labels[2]; int cursorPos = fc.CursorPos; if ((Object)fdDate != null && cursorPos >= 0) { if (cursorPos < this.fdDate.Length) { string text = DateTime.FromOADate(this.fdDate[cursorPos]).ToString(this.CursorFormat, DateTimeFormatInfo.InvariantInfo); SizeF ef = g.MeasureString(text, this.LabelFont); RectangleF rect = new RectangleF(X - fc.Rect.X, (float)this.Rect.Y, ef.Width, (float)(this.Rect.Height - 1)); this.LastCursorRect = rect; this.LastCursorRect.Inflate(2f, 1f); rect.Offset((PointF)fc.Rect.Location); label.DrawString(g, text, this.LabelFont, label.TextBrush, VerticalAlign.Bottom, FormulaAlign.Left, rect, false); } } }
/// <summary> /// Draw date label at X /// </summary> /// <param name="g"></param> /// <param name="fc"></param> /// <param name="Area"></param> /// <param name="X"></param> public void DrawCursor(Graphics g, FormulaChart fc, FormulaArea Area, float X) { if (!LastCursorRect.IsEmpty) { fc.RestoreMemBmp(g, LastCursorRect); } FormulaLabel fl = Area.Labels[2]; int i = fc.CursorPos; if ((object)fdDate != null) { if (i >= 0) { DateTime D = fc.IndexToDate(i); string s = D.ToString(CursorFormat); //,DateTimeFormatInfo.InvariantInfo SizeF sf = g.MeasureString(s, LabelFont); RectangleF R = new RectangleF(X - fc.Rect.X, Rect.Y, sf.Width, Rect.Height - 1); if (R.Right > Rect.Right) { R.Offset(-R.Width - 1, 0); } LastCursorRect = R; LastCursorRect.Inflate(2, 1); R.Offset(fc.Rect.Location); fl.DrawString(g, s, LabelFont, fl.TextBrush, VerticalAlign.Bottom, FormulaAlign.Left, R, false); } } }
public void DrawCursor(Graphics g, FormulaChart fc, FormulaArea Area, float Y, double d) { if (!this.LastCursorRect.IsEmpty) { fc.RestoreMemBmp(g, this.LastCursorRect); } FormulaLabel label = Area.Labels[2]; string text = d.ToString(this.Format); SizeF ef = g.MeasureString(text, this.LabelFont); RectangleF rect = new RectangleF((float)this.Rect.Left, Y - fc.Rect.Y, (this.Rect.Width - 1) - this.Back.RightPen.Width, ef.Height); this.LastCursorRect = rect; this.LastCursorRect.Inflate(2f, 1f); rect.Offset((PointF)fc.Rect.Location); label.DrawString(g, text, this.LabelFont, label.TextBrush, VerticalAlign.Bottom, FormulaAlign.Left, rect, false); }
/// <summary> /// Draw price label at Y /// </summary> /// <param name="g"></param> /// <param name="fc"></param> /// <param name="Area"></param> /// <param name="Y">Y-Position</param> /// <param name="d">Price</param> public void DrawCursor(Graphics g, FormulaChart fc, FormulaArea Area, float Y, double d) { if (!LastCursorRect.IsEmpty) { fc.RestoreMemBmp(g, LastCursorRect); } FormulaLabel fl = Area.Labels[2]; string s = FormulaHelper.FormatDouble(d, format); SizeF sf = g.MeasureString(s, LabelFont); RectangleF R = new RectangleF(Rect.Left, Y - fc.Rect.Y, Rect.Width - 1 - Back.RightPen.Width, sf.Height); LastCursorRect = R; LastCursorRect.Inflate(2, 1); R.Offset(fc.Rect.Location); fl.DrawString(g, s, LabelFont, fl.TextBrush, VerticalAlign.Bottom, FormulaAlign.Left, R, false); }