diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index c9400ae..e4832ab 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -1886,6 +1886,7 @@ namespace EduNetworkBuilder private void pbNetworkView_MouseMove(object sender, MouseEventArgs e) { + Image tImage; //Only do this 10 times a second if (DateTime.UtcNow - LastMoveTime < TimeSpan.FromMilliseconds(100)) return; @@ -1894,7 +1895,25 @@ namespace EduNetworkBuilder //If we are dragging lines, do that first. if (selectedButton == "btnLink") { - //We are trying to do a link. Do not drag... + if (MouseIsDown) + { + //We are trying to do a link. Drag a line... + if (ItemClickedOn != null) + { + Point OrigCenter = ItemClickedOn.GetCenter(); + //Draw a line from the item-clicked on to the mouse + tImage = new Bitmap(pbNetworkView.BackgroundImage.Width, pbNetworkView.BackgroundImage.Height); + Graphics tGraphics = Graphics.FromImage(tImage); + tGraphics.Clear(Color.Transparent); //erase the whole thing + + //draw the line + //tGraphics.FillRectangle(semiTransBrush, selectbox); + tGraphics.DrawLine(Pens.Black, OrigCenter, MouseLocation); + pbNetworkView.Image = tImage; + pbNetworkView.Invalidate(); + + } + } } else if (MouseIsDown && LastBackgroundImage != null && ItemClickedOn != null && ItemsSelected.Count == 0) //We are trying to drag something { @@ -1924,7 +1943,7 @@ namespace EduNetworkBuilder else if (MouseIsDown && ItemClickedOn == null) //Dragging an empty area { //make a rectangle - Image tImage = new Bitmap(pbNetworkView.BackgroundImage.Width, pbNetworkView.BackgroundImage.Height); + tImage = new Bitmap(pbNetworkView.BackgroundImage.Width, pbNetworkView.BackgroundImage.Height); Graphics tGraphics = Graphics.FromImage(tImage); tGraphics.Clear(Color.Transparent); //erase the whole thing int sx;