コード例 #1
0
ファイル: PriceShapePainter.cs プロジェクト: wanwei/sc2
        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;
            }
        }
コード例 #2
0
ファイル: PriceShapePainter.cs プロジェクト: wanwei/sc2
        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);
        }
コード例 #3
0
ファイル: PriceShapePainter.cs プロジェクト: wanwei/sc2
        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);
        }
コード例 #4
0
ファイル: PriceShapePainter.cs プロジェクト: wanwei/sc2
        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);
        }
コード例 #5
0
ファイル: PriceShapePainter.cs プロジェクト: wanwei/sc2
        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);
        }
コード例 #6
0
ファイル: PriceShapeContainer.cs プロジェクト: wanwei/sc2
        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);
                }
            }
        }
コード例 #7
0
ファイル: PriceShapePainter.cs プロジェクト: wanwei/sc2
        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);
            }
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
 public void RemoveShape(IPriceShape shape)
 {
     this.shapes.Remove(shape);
 }
コード例 #10
0
 public void DrawPriceShape(IPriceShape priceShape)
 {
     this.shapes.Add(priceShape);
 }
コード例 #11
0
 private void RecordShape(IPriceShape shape)
 {
     this.priceShapes.Add(shape);
     DrawShape(shape);
 }
コード例 #12
0
ファイル: PriceShapeContainer.cs プロジェクト: wanwei/sc2
 public void RemovePriceShape(IPriceShape priceShape)
 {
     priceShapes.Remove(priceShape);
 }
コード例 #13
0
ファイル: PriceShapeContainer.cs プロジェクト: wanwei/sc2
 public void AddPriceShape(IPriceShape priceShape)
 {
     priceShapes.Add(priceShape);
 }