Ejemplo n.º 1
0
        private void pbMap_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                //get mouse xy etc
                PointF mouseLocation = new PointF(e.Location.X, e.Location.Y);

                //find node
                GameNode node = _viewer.FindNodeAtPoint(mouseLocation);
                if (node != _startNode)
                {
                    _endNode = node;

                    //addlink
                    //confirm first!!!!
                    if ((_startNode != null) && (_endNode != null))
                    {
                        if (MessageBox.Show("Create link?", "New Link", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            _startNode.AddNeighbour(_endNode, true);
                        }
                    }

                    _startNode = null;
                    _endNode   = null;

                    DisplayMap();
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                //context menu
            }
        }