Пример #1
0
        private void OnAddVertex(object sender, IVertex vertex)
        {
            PointF location = new PointF(Random.Next(0, Width - 40), Random.Next(0, Height - 40));
            var points = new PointF[] { location };
            inverse_transformation.TransformPoints(points);
            location = new Point((int)points[0].X, (int)points[0].Y);

            int radio = Random.Next(6, 12);
            RectangleF bound = new RectangleF(location.X - radio, location.Y - radio, radio * 2, radio * 2);
            vertex.SetAlgorithmObj(_KH_PANE_LOCATION, location);
            vertex.SetAlgorithmObj(_KH_PANE_BOUNDS, bound);
            vertex.SetAlgorithmObj(_KH_PANE_GRAPH_PRIOR, 0);
            vertex.SetAlgorithmObj(Flags.State.None.ToString(), false);
            vertex.SetAlgorithmObj(Flags.State.Focus.ToString(), false);
            vertex.SetAlgorithmObj(Flags.State.Hover.ToString(), false);
            vertex.SetAlgorithmObj(Flags.State.DraggedOver.ToString(), false);
            vertex.SetAlgorithmObj(Flags.State.Dragging.ToString(), false);
            vertex.SetAlgorithmObj(Flags.State.HighLight.ToString(), false);
            vertex.OnAttributeChange += OnAttributeChange;
            NeedRefresh = true;
            //this.Refresh();
        }