Exemplo n.º 1
0
        private void CreatePoint(int value)
        {
            double x, y;

            GetCoords(value, out x, out y);
            y -= PointRadius;
            x -= PointRadius;

            Ellipse point = m_Points.ContainsKey(value) ? GetEllipseAt(m_Points[value]) : null;

            if (point == null)
            {
                point         = ControlHandler.CreateObject(typeof(Ellipse)) as Ellipse;
                point.ToolTip = new ToolTip();
                (point.ToolTip as ToolTip).Content = value.ToString();
                ControlHandler.SetPropertyValue(point, "Width", PointRadius * 2);
                ControlHandler.SetPropertyValue(point, "Height", PointRadius * 2);
                ControlHandler.SetPropertyValue(point, "Fill", Brushes.Black);
                ControlHandler.SetPropertyValue(point, "Stroke", Brushes.Black);
                ControlHandler.SetPropertyValue(point, "StrokeThickness", 1.0);
                ControlHandler.AddChild(point, PaintArea);
            }

            ControlHandler.ExecuteMethod(PaintArea, "SetLeft", new object[] { point, x });
            ControlHandler.ExecuteMethod(PaintArea, "SetTop", new object[] { point, y });

            if (m_CirclesSource.ContainsKey(point))
            {
                MoveCircle(point);
            }

            if (m_Points.ContainsKey(value))
            {
                m_Points[value] = new Point(x, y);
            }
            else
            {
                m_Points.Add(value, new Point(x, y));
            }

            Label  lbl   = ControlHandler.CreateLabel(value.ToString(), null);
            double _left = x - 5;
            double _top  = y;

            _left += (x < Radius) ? -7 + (-2 * (int)Math.Log(value)) : 2;
            _top  += (y < Radius) ? -20 : 0;
            ControlHandler.ExecuteMethod(PaintArea, "SetLeft", new object[] { lbl, _left });
            ControlHandler.ExecuteMethod(PaintArea, "SetTop", new object[] { lbl, _top });
            ControlHandler.AddChild(lbl, LabelArea);
        }
Exemplo n.º 2
0
        private void CreatePoint(int value)
        {
            double pointsize = 4.0;
            double angle     = (360.0 / (double)m_Value.IntValue) * value;
            double top       = Radius + 25 + (Math.Sin((angle * 2 * Math.PI) / 360.0) * Radius - (pointsize / 2.0));
            double left      = Radius + 25 + (Math.Cos((angle * 2 * Math.PI) / 360.0) * Radius - (pointsize / 2.0));

            Ellipse point = ControlHandler.CreateObject(typeof(Ellipse)) as Ellipse;

            ControlHandler.SetPropertyValue(point, "Width", pointsize);
            ControlHandler.SetPropertyValue(point, "Height", pointsize);
            ControlHandler.ExecuteMethod(PaintArea, "SetTop", new object[] { point, top });
            ControlHandler.ExecuteMethod(PaintArea, "SetLeft", new object[] { point, left });
            ControlHandler.SetPropertyValue(point, "Fill", Brushes.Black);
            ControlHandler.SetPropertyValue(point, "Stroke", Brushes.Black);
            ControlHandler.SetPropertyValue(point, "StrokeThickness", 1.0);
            ControlHandler.AddChild(point, PaintArea);

            Label  lbl   = ControlHandler.CreateLabel(value.ToString(), null);
            double _top  = top;
            double _left = left - 5;

            _top  += (top < Radius) ? -20 : 0;
            _left += (left < Radius) ? -7 + (-2 * (int)Math.Log(value)) : 2;
            ControlHandler.ExecuteMethod(PaintArea, "SetTop", new object[] { lbl, _top });
            ControlHandler.ExecuteMethod(PaintArea, "SetLeft", new object[] { lbl, _left });
            ControlHandler.AddChild(lbl, PaintArea);
            if (m_Points.ContainsKey(value))
            {
                m_Points[value] = new Point(left, top);
            }
            else
            {
                m_Points.Add(value, new Point(left, top));
            }
        }