diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index 0aa90b0..b1893eb 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -18,6 +18,8 @@ Public Class GUI Dim PointButtons As New List(Of Button) + Dim angleCounter As Integer + ' --- Start method when GUI loads --- Sub GUI_load() Handles MyBase.Load containerPanel = DrawingPanel @@ -189,8 +191,10 @@ Public Class GUI containerPanel.Controls.Add(PointButtons(i)) - AddHandler PointButtons(i).Click, AddressOf Me.PointButton_Click + AddHandler PointButtons(i).Click, AddressOf PointButton_Click Next + + angleCounter = angleCounter + 1 End Sub Private Sub PointButton_Click(sender As Button, e As EventArgs) @@ -209,34 +213,34 @@ Public Class GUI If tempX < containerMidX Then If tempY > containerMidY Then 'Kvadrant 4 - points.Add("pA1", {tempX + d1, tempY, 0, 0}) - points.Add("pA2", {tempX, tempY - d2, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {tempX + d1, tempY, 0, 0}) + points.Add("pA" & angleCounter * 2, {tempX, tempY - d2, 0, 0}) Else 'Kvadrant 1 - points.Add("pA1", {tempX, tempY + d2, 0, 0}) - points.Add("pA2", {tempX + d1, tempY, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {tempX, tempY + d2, 0, 0}) + points.Add("pA" & angleCounter * 2, {tempX + d1, tempY, 0, 0}) End If Else If tempY > containerMidY Then 'Kvadrant 3 - points.Add("pA1", {tempX, tempY - d2, 0, 0}) - points.Add("pA2", {tempX - d1, tempY, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {tempX, tempY - d2, 0, 0}) + points.Add("pA" & angleCounter * 2, {tempX - d1, tempY, 0, 0}) Else 'Kvadrant 2 - points.Add("pA1", {tempX - d1, tempY, 0, 0}) - points.Add("pA2", {tempX, tempY + d2, 0, 0}) + points.Add("pA" & angleCounter * 2 - 1, {tempX - d1, tempY, 0, 0}) + points.Add("pA" & angleCounter * 2, {tempX, tempY + d2, 0, 0}) End If End If 'Insert two new points - pointsOrder.Insert(index + 1, "pA1") - pointsOrder.Insert(index + 2, "pA2") + pointsOrder.Insert(index + 1, "pA" & angleCounter * 2 - 1) + pointsOrder.Insert(index + 2, "pA" & angleCounter * 2) pointsOrder.RemoveAt(index) - 'Remove points buttons For i = 0 To PointButtons.Count - 1 - RemoveHandler PointButtons(i).Click, AddressOf Me.PointButton_Click - containerPanel.Controls.RemoveByKey(PointButtons(i).Name) + RemoveHandler PointButtons(0).Click, AddressOf PointButton_Click + containerPanel.Controls.RemoveByKey(PointButtons(0).Name) + PointButtons.RemoveAt(0) Next 'Redraw grating