public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { switch (shape.GetShapeType()) { case PriceShapeType.Point: shapePainter_Point.Paint(g, priceGraphic, shape); break; case PriceShapeType.Line: shapePainter_Line.Paint(g, priceGraphic, shape); break; case PriceShapeType.PolyLine: shapePainter_PolyLine.Paint(g, priceGraphic, shape); break; case PriceShapeType.Label: shapePainter_Label.Paint(g, priceGraphic, shape); break; case PriceShapeType.Rect: shapePainter_Rect.Paint(g, priceGraphic, shape); break; } }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Point point = (PriceShape_Point)shape; float x1 = priceGraphic.CalcX(point.X); float y1 = priceGraphic.CalcY(point.Y); float w = point.Width; g.FillEllipse(new SolidBrush(point.Color), x1 - point.Width / 2, y1 - point.Width / 2, point.Width, point.Width); }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Label label = (PriceShape_Label)shape; float x1 = priceGraphic.CalcX(label.Point.X); float y1 = priceGraphic.CalcY(label.Point.Y); Font font = label.Font != null ? label.Font : new Font("宋体", 14.2f, FontStyle.Regular); StringFormat sf = label.StringFormat != null ? label.StringFormat : new StringFormat(StringFormatFlags.DirectionVertical); g.DrawString(label.Text, font, new SolidBrush(label.Color), new PointF(x1, y1), sf); }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_PolyLine line = (PriceShape_PolyLine)shape; PointF[] points = new PointF[line.Points.Count]; for (int i = 0; i < line.Points.Count; i++) { points[i] = GetPointF(priceGraphic, line.Points[i]); } g.DrawLines(new Pen(line.Color, line.Width), points); }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Line line = (PriceShape_Line)shape; float x1 = priceGraphic.CalcX(line.StartPoint.X); float y1 = priceGraphic.CalcY(line.StartPoint.Y); float x2 = priceGraphic.CalcX(line.EndPoint.X); float y2 = priceGraphic.CalcY(line.EndPoint.Y); g.DrawLine(new Pen(line.Color, line.Width), x1, y1, x2, y2); }
public virtual void Load(XmlElement xmlElem) { XmlNodeList nodes = xmlElem.GetElementsByTagName("shape"); for (int i = 0; i < nodes.Count; i++) { XmlNode node = nodes[i]; if (node is XmlElement) { XmlElement elem = (XmlElement)node; IPriceShape priceShape = PriceShapeFactory.CreatePriceShape(elem); priceShape.Load(elem); this.priceShapes.Add(priceShape); } } }
public void Paint(Graphics g, PriceGraphicMapping priceGraphic, IPriceShape shape) { PriceShape_Rect point = (PriceShape_Rect)shape; float x1 = priceGraphic.CalcX(point.PriceLeft); float y1 = priceGraphic.CalcY(point.PriceTop); float x2 = priceGraphic.CalcX(point.PriceRight); float y2 = priceGraphic.CalcY(point.PriceBottom); if (!point.FillRect) { g.DrawRectangle(new Pen(point.Color), x1, y1, x2 - x1, y2 - y1); } else { g.FillRectangle(new SolidBrush(point.Color), x1, y1, x2 - x1, y2 - y1); } }
private void DrawShape(IPriceShape shape) { if (shape is StrategyShape) { this.DrawShape2((StrategyShape)shape); } else { PriceRectangle priceRect = mapping.PriceRect; int start = priceRect.StartIndex; int end = priceRect.EndIndex; if (shape.GetShapeType() == PriceShapeType.Point) { PriceShape_Point point = (PriceShape_Point)shape; if (point.X < start || point.X > end) { return; } } this.drawer.DrawPriceShape(shape); } }
public void RemoveShape(IPriceShape shape) { this.shapes.Remove(shape); }
public void DrawPriceShape(IPriceShape priceShape) { this.shapes.Add(priceShape); }
private void RecordShape(IPriceShape shape) { this.priceShapes.Add(shape); DrawShape(shape); }
public void RemovePriceShape(IPriceShape priceShape) { priceShapes.Remove(priceShape); }
public void AddPriceShape(IPriceShape priceShape) { priceShapes.Add(priceShape); }