Clicking the shape button toggles which shape you are adding.
This commit is contained in:
parent
c75f1407f9
commit
3ff8f1488c
@ -414,6 +414,7 @@
|
|||||||
</FileAssociation>
|
</FileAssociation>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="Resources\Square.png" />
|
||||||
<None Include="Resources\Shapes.png" />
|
<None Include="Resources\Shapes.png" />
|
||||||
<None Include="Resources\tree.png" />
|
<None Include="Resources\tree.png" />
|
||||||
<None Include="Resources\WAP.png" />
|
<None Include="Resources\WAP.png" />
|
||||||
@ -442,6 +443,7 @@
|
|||||||
<None Include="Resources\Laptop.png" />
|
<None Include="Resources\Laptop.png" />
|
||||||
<None Include="Resources\microwave.png" />
|
<None Include="Resources\microwave.png" />
|
||||||
<None Include="Resources\Animations.png" />
|
<None Include="Resources\Animations.png" />
|
||||||
|
<None Include="Resources\Circle.png" />
|
||||||
<Content Include="Resources\NBIco.ico" />
|
<Content Include="Resources\NBIco.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
@ -61,18 +61,27 @@ namespace EduNetworkBuilder
|
|||||||
if (FillColor == Color.Black) edgeColor = Color.White;
|
if (FillColor == Color.Black) edgeColor = Color.White;
|
||||||
coloredBrush = new SolidBrush(edgeColor);
|
coloredBrush = new SolidBrush(edgeColor);
|
||||||
//We want to put drag-marks on the corners of our rectangle
|
//We want to put drag-marks on the corners of our rectangle
|
||||||
Rectangle TL = new Rectangle(InArea.X, InArea.Y, sz, sz);
|
foreach(Rectangle one in Corners())
|
||||||
Rectangle TR = new Rectangle(InArea.X + InArea.Width - sz, InArea.Y, sz, sz);
|
G.FillRectangle(coloredBrush, one);
|
||||||
Rectangle BL = new Rectangle(InArea.X, InArea.Y + InArea.Height - sz, sz, sz);
|
|
||||||
Rectangle BR = new Rectangle(InArea.X + InArea.Width - sz, InArea.Y + InArea.Height - sz, sz, sz);
|
|
||||||
G.FillRectangle(coloredBrush, TL);
|
|
||||||
G.FillRectangle(coloredBrush, TR);
|
|
||||||
G.FillRectangle(coloredBrush, BL);
|
|
||||||
G.FillRectangle(coloredBrush, BR);
|
|
||||||
}
|
}
|
||||||
G.Dispose();
|
G.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Rectangle> Corners()
|
||||||
|
{
|
||||||
|
int sz = DragSize;
|
||||||
|
List<Rectangle> tCorners = new List<Rectangle>();
|
||||||
|
Rectangle TL = new Rectangle(InArea.X, InArea.Y, sz, sz);
|
||||||
|
Rectangle TR = new Rectangle(InArea.X + InArea.Width - sz, InArea.Y, sz, sz);
|
||||||
|
Rectangle BL = new Rectangle(InArea.X, InArea.Y + InArea.Height - sz, sz, sz);
|
||||||
|
Rectangle BR = new Rectangle(InArea.X + InArea.Width - sz, InArea.Y + InArea.Height - sz, sz, sz);
|
||||||
|
tCorners.Add(TL);
|
||||||
|
tCorners.Add(TR);
|
||||||
|
tCorners.Add(BL);
|
||||||
|
tCorners.Add(BR);
|
||||||
|
return tCorners;
|
||||||
|
}
|
||||||
|
|
||||||
public void Load(XmlNode theNode)
|
public void Load(XmlNode theNode)
|
||||||
{
|
{
|
||||||
foreach (XmlNode Individual in theNode.ChildNodes)
|
foreach (XmlNode Individual in theNode.ChildNodes)
|
||||||
|
@ -53,6 +53,8 @@ namespace EduNetworkBuilder
|
|||||||
private List<NetworkDevice> ItemsSelected = new List<NetworkDevice>();
|
private List<NetworkDevice> ItemsSelected = new List<NetworkDevice>();
|
||||||
private Point OrigClickPoint = new Point(-1, -1);
|
private Point OrigClickPoint = new Point(-1, -1);
|
||||||
|
|
||||||
|
private NetShapeType CurrentShape = NetShapeType.none;
|
||||||
|
|
||||||
private string InitialFileLoad = "";
|
private string InitialFileLoad = "";
|
||||||
|
|
||||||
public PersonClass CurrentUser;
|
public PersonClass CurrentUser;
|
||||||
@ -558,7 +560,8 @@ namespace EduNetworkBuilder
|
|||||||
UpdateMenu();
|
UpdateMenu();
|
||||||
UpdateMessages();
|
UpdateMessages();
|
||||||
UpdateVisuals();
|
UpdateVisuals();
|
||||||
if(selectedButton == "btnShapes")
|
btnUpdateShape();
|
||||||
|
if (selectedButton == "btnShapes")
|
||||||
{
|
{
|
||||||
cbFillColor.Visible = true;
|
cbFillColor.Visible = true;
|
||||||
cbLineColor.Visible = true;
|
cbLineColor.Visible = true;
|
||||||
@ -744,11 +747,21 @@ namespace EduNetworkBuilder
|
|||||||
myNetwork.InShapeEditMode = true;
|
myNetwork.InShapeEditMode = true;
|
||||||
if (selectedButton == "btnShapes") {
|
if (selectedButton == "btnShapes") {
|
||||||
myNetwork.InShapeEditMode = true;
|
myNetwork.InShapeEditMode = true;
|
||||||
|
if (CurrentShape == NetShapeType.none) CurrentShape = NetShapeType.rectangle;
|
||||||
|
if(doupdate)
|
||||||
|
{
|
||||||
|
//The shape was already selected. Toggle it
|
||||||
|
if (CurrentShape == NetShapeType.rectangle) CurrentShape = NetShapeType.circle;
|
||||||
|
else CurrentShape = NetShapeType.rectangle;
|
||||||
|
}
|
||||||
|
if (CurrentShape == NetShapeType.rectangle) btn.BackgroundImage = Properties.Resources.Square;
|
||||||
|
if (CurrentShape == NetShapeType.circle) btn.BackgroundImage = Properties.Resources.Circle;
|
||||||
doupdate = true;
|
doupdate = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myNetwork.InShapeEditMode = false;
|
myNetwork.InShapeEditMode = false;
|
||||||
|
CurrentShape = NetShapeType.none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -756,15 +769,37 @@ namespace EduNetworkBuilder
|
|||||||
btn.BackColor = Button.DefaultBackColor;
|
btn.BackColor = Button.DefaultBackColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (doupdate) { UpdateForm(); }
|
if (doupdate) {
|
||||||
|
UpdateForm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnReset()
|
private void btnReset()
|
||||||
{
|
{
|
||||||
foreach (Control btn in Buttons)
|
foreach (Control btn in Buttons)
|
||||||
{
|
{
|
||||||
lblStatus.Text = "";
|
lblStatus.Text = "";
|
||||||
selectedButton = "";
|
selectedButton = "";
|
||||||
|
CurrentShape = NetShapeType.none;
|
||||||
btn.BackColor = Button.DefaultBackColor;
|
btn.BackColor = Button.DefaultBackColor;
|
||||||
|
if(btn.Name == "btnShapes")
|
||||||
|
{
|
||||||
|
if (CurrentShape == NetShapeType.rectangle) btn.BackgroundImage = Properties.Resources.Square;
|
||||||
|
if (CurrentShape == NetShapeType.circle) btn.BackgroundImage = Properties.Resources.Circle;
|
||||||
|
if (CurrentShape == NetShapeType.none) btn.BackgroundImage = Properties.Resources.Shapes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void btnUpdateShape()
|
||||||
|
{
|
||||||
|
foreach (Control btn in Buttons)
|
||||||
|
{
|
||||||
|
if (btn.Name == "btnShapes")
|
||||||
|
{
|
||||||
|
if (CurrentShape == NetShapeType.rectangle) btn.BackgroundImage = Properties.Resources.Square;
|
||||||
|
if (CurrentShape == NetShapeType.circle) btn.BackgroundImage = Properties.Resources.Circle;
|
||||||
|
if (CurrentShape == NetShapeType.none) btn.BackgroundImage = Properties.Resources.Shapes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
EduNetworkBuilder/Properties/Resources.Designer.cs
generated
20
EduNetworkBuilder/Properties/Resources.Designer.cs
generated
@ -110,6 +110,16 @@ namespace EduNetworkBuilder.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Circle {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Circle", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1250,6 +1260,16 @@ namespace EduNetworkBuilder.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Square {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Square", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -505,9 +505,15 @@
|
|||||||
<data name="Level0_Frozen" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Level0_Frozen" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Level0_Frozen.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>..\Resources\Level0_Frozen.enbx;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Circle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="Shapes" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Shapes" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Shapes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Shapes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Square" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Square.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="tree" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<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>
|
<value>..\Resources\tree.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
BIN
EduNetworkBuilder/Resources/Circle.png
Normal file
BIN
EduNetworkBuilder/Resources/Circle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
EduNetworkBuilder/Resources/Square.png
Normal file
BIN
EduNetworkBuilder/Resources/Square.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 530 B |
Loading…
Reference in New Issue
Block a user