When adding a link between devices, show a line so we see we are doing it.

This commit is contained in:
Tim Young 2023-08-15 15:37:29 -07:00
parent c227e8676b
commit 5fc1e19f71

View File

@ -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;