Draw an X in the center of images when we are in shape mode. We will right-click this center to delete or edit the shape.

This commit is contained in:
Tim Young 2018-02-28 12:03:08 -06:00
parent 4531e0526a
commit e3fe80ea42
5 changed files with 35 additions and 0 deletions

View File

@ -414,6 +414,7 @@
</FileAssociation>
</ItemGroup>
<ItemGroup>
<None Include="Resources\X.png" />
<None Include="Resources\Square.png" />
<None Include="Resources\Shapes.png" />
<None Include="Resources\tree.png" />

View File

@ -64,6 +64,7 @@ namespace EduNetworkBuilder
//We want to put drag-marks on the corners of our rectangle
foreach(Rectangle one in Corners())
G.FillRectangle(coloredBrush, one);
G.DrawImage(Properties.Resources.X, Center());
}
G.Dispose();
}
@ -83,6 +84,19 @@ namespace EduNetworkBuilder
return tCorners;
}
//A rectangle in the center of the shape that we can click on
Rectangle Center()
{
int size = 100;
if (InArea.Width < 200 || InArea.Height < 200)
size = 50;
if (InArea.Width < size || InArea.Height < size)
size = Math.Min(InArea.Width / 2, InArea.Height / 2);
int cx = InArea.X + (InArea.Width / 2);
int cy = InArea.Y + (InArea.Height / 2);
return new Rectangle(cx - (size / 2), cy - (size / 2), size, size);
}
public bool CornersAreClickedOn(Point ClickPoint)
{
foreach(Rectangle rec in Corners())
@ -93,6 +107,13 @@ namespace EduNetworkBuilder
return false;
}
public bool CenterIsClickedOn(Point ClickPoint)
{
if (Center().Contains(ClickPoint))
return true;
return false;
}
/// <summary>
/// return the opposite point from the one clicked on. This is so we can start
/// dragging from here.

View File

@ -1409,5 +1409,15 @@ namespace EduNetworkBuilder.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap X {
get {
object obj = ResourceManager.GetObject("X", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -517,4 +517,7 @@
<data name="tree" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tree.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="X" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\X.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB