Clicking the shape button toggles which shape you are adding.
This commit is contained in:
parent
c75f1407f9
commit
3ff8f1488c
@ -414,6 +414,7 @@
|
||||
</FileAssociation>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Square.png" />
|
||||
<None Include="Resources\Shapes.png" />
|
||||
<None Include="Resources\tree.png" />
|
||||
<None Include="Resources\WAP.png" />
|
||||
@ -442,6 +443,7 @@
|
||||
<None Include="Resources\Laptop.png" />
|
||||
<None Include="Resources\microwave.png" />
|
||||
<None Include="Resources\Animations.png" />
|
||||
<None Include="Resources\Circle.png" />
|
||||
<Content Include="Resources\NBIco.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
@ -61,16 +61,25 @@ namespace EduNetworkBuilder
|
||||
if (FillColor == Color.Black) edgeColor = Color.White;
|
||||
coloredBrush = new SolidBrush(edgeColor);
|
||||
//We want to put drag-marks on the corners of our rectangle
|
||||
foreach(Rectangle one in Corners())
|
||||
G.FillRectangle(coloredBrush, one);
|
||||
}
|
||||
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);
|
||||
G.FillRectangle(coloredBrush, TL);
|
||||
G.FillRectangle(coloredBrush, TR);
|
||||
G.FillRectangle(coloredBrush, BL);
|
||||
G.FillRectangle(coloredBrush, BR);
|
||||
}
|
||||
G.Dispose();
|
||||
tCorners.Add(TL);
|
||||
tCorners.Add(TR);
|
||||
tCorners.Add(BL);
|
||||
tCorners.Add(BR);
|
||||
return tCorners;
|
||||
}
|
||||
|
||||
public void Load(XmlNode theNode)
|
||||
|
@ -53,6 +53,8 @@ namespace EduNetworkBuilder
|
||||
private List<NetworkDevice> ItemsSelected = new List<NetworkDevice>();
|
||||
private Point OrigClickPoint = new Point(-1, -1);
|
||||
|
||||
private NetShapeType CurrentShape = NetShapeType.none;
|
||||
|
||||
private string InitialFileLoad = "";
|
||||
|
||||
public PersonClass CurrentUser;
|
||||
@ -558,7 +560,8 @@ namespace EduNetworkBuilder
|
||||
UpdateMenu();
|
||||
UpdateMessages();
|
||||
UpdateVisuals();
|
||||
if(selectedButton == "btnShapes")
|
||||
btnUpdateShape();
|
||||
if (selectedButton == "btnShapes")
|
||||
{
|
||||
cbFillColor.Visible = true;
|
||||
cbLineColor.Visible = true;
|
||||
@ -744,11 +747,21 @@ namespace EduNetworkBuilder
|
||||
myNetwork.InShapeEditMode = true;
|
||||
if (selectedButton == "btnShapes") {
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
myNetwork.InShapeEditMode = false;
|
||||
CurrentShape = NetShapeType.none;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -756,15 +769,37 @@ namespace EduNetworkBuilder
|
||||
btn.BackColor = Button.DefaultBackColor;
|
||||
}
|
||||
}
|
||||
if (doupdate) { UpdateForm(); }
|
||||
if (doupdate) {
|
||||
UpdateForm();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnReset()
|
||||
{
|
||||
foreach (Control btn in Buttons)
|
||||
{
|
||||
lblStatus.Text = "";
|
||||
selectedButton = "";
|
||||
CurrentShape = NetShapeType.none;
|
||||
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>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </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>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
@ -505,9 +505,15 @@
|
||||
<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>
|
||||
</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">
|
||||
<value>..\Resources\Shapes.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</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">
|
||||
<value>..\Resources\tree.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</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