Functions for add angle
This commit is contained in:
parent
953e569533
commit
37a2511b65
|
|
@ -229,53 +229,62 @@ Public Class GUI
|
||||||
' --- When angle button is pressed ---
|
' --- When angle button is pressed ---
|
||||||
Private Sub AngleButton_Click(sender As Object, e As EventArgs) Handles AngleButton.Click
|
Private Sub AngleButton_Click(sender As Object, e As EventArgs) Handles AngleButton.Click
|
||||||
' Add TextBoxes with Labels
|
' Add TextBoxes with Labels
|
||||||
Dim XValueBox As New TextBox
|
Create_TextBox("X_TextBox", "", 32, 189, 60)
|
||||||
XValueBox.Name = "X_TextBox"
|
AddHandler Me.Controls("X_TextBox").TextChanged, AddressOf AngleText_Changed
|
||||||
XValueBox.Text = "50"
|
Create_TextBox("Y_TextBox", "", 140, 189, 60)
|
||||||
XValueBox.Left = 32
|
AddHandler Me.Controls("Y_TextBox").TextChanged, AddressOf AngleText_Changed
|
||||||
XValueBox.Top = 189
|
|
||||||
XValueBox.Width = 60
|
|
||||||
XValueBox.Font = New Font("Microsoft Sans Serif", 10)
|
|
||||||
Me.Controls.Add(XValueBox)
|
|
||||||
|
|
||||||
Dim YValueBox As New TextBox
|
|
||||||
YValueBox.Name = "Y_TextBox"
|
|
||||||
YValueBox.Text = "50"
|
|
||||||
YValueBox.Left = 140
|
|
||||||
YValueBox.Top = 189
|
|
||||||
YValueBox.Width = 60
|
|
||||||
YValueBox.Font = New Font("Microsoft Sans Serif", 10)
|
|
||||||
Me.Controls.Add(YValueBox)
|
|
||||||
|
|
||||||
' Create Buttons for all clickable points
|
End Sub
|
||||||
For i = 0 To pointsOrder.Count - 1
|
|
||||||
PointButtons.Add(New Button)
|
|
||||||
|
|
||||||
PointButtons(i).Width = 30
|
Private Sub Create_TextBox(TextBoxName As String, TextBoxText As String, TextBoxLeft As Integer, TextBoxTop As Integer, TextBoxWidth As Integer)
|
||||||
PointButtons(i).Height = 30
|
Dim textBoxTemp As New TextBox
|
||||||
|
textBoxTemp.Name = TextBoxName
|
||||||
|
textBoxTemp.Text = TextBoxText
|
||||||
|
textBoxTemp.Left = TextBoxLeft
|
||||||
|
textBoxTemp.Top = TextBoxTop
|
||||||
|
textBoxTemp.Width = TextBoxWidth
|
||||||
|
textBoxTemp.Font = New Font("Microsoft Sans Serif", 10)
|
||||||
|
Me.Controls.Add(textBoxTemp)
|
||||||
|
End Sub
|
||||||
|
|
||||||
PointButtons(i).Left = points(pointsOrder(i))(0) - PointButtons(i).Width / 2
|
Private Sub AngleText_Changed(sender As TextBox, e As EventArgs)
|
||||||
PointButtons(i).Top = points(pointsOrder(i))(1) - PointButtons(i).Height / 2
|
If Not Me.Controls("X_TextBox").Text = "" And Not Me.Controls("Y_TextBox").Text = "" Then
|
||||||
|
If containerPanel.Controls.Count = 0 Then
|
||||||
|
' Create Buttons for all clickable points
|
||||||
|
For i = 0 To pointsOrder.Count - 1
|
||||||
|
PointButtons.Add(New Button)
|
||||||
|
|
||||||
PointButtons(i).Name = pointsOrder(i) & "_Button"
|
PointButtons(i).Width = 30
|
||||||
PointButtons(i).Text = ""
|
PointButtons(i).Height = 30
|
||||||
|
|
||||||
PointButtons(i).BackColor = Color.FromArgb(50, Color.Red)
|
PointButtons(i).Left = points(pointsOrder(i))(0) - PointButtons(i).Width / 2
|
||||||
PointButtons(i).FlatStyle = FlatStyle.Flat
|
PointButtons(i).Top = points(pointsOrder(i))(1) - PointButtons(i).Height / 2
|
||||||
PointButtons(i).FlatAppearance.BorderSize = 0
|
|
||||||
PointButtons(i).FlatAppearance.MouseOverBackColor = Color.Red
|
|
||||||
PointButtons(i).FlatAppearance.MouseDownBackColor = Color.DarkRed
|
|
||||||
|
|
||||||
Dim gp As New Drawing.Drawing2D.GraphicsPath
|
PointButtons(i).Name = pointsOrder(i) & "_Button"
|
||||||
gp.AddEllipse(New Rectangle(New Point(0, 0), New Size(30, 30)))
|
PointButtons(i).Text = ""
|
||||||
PointButtons(i).Region = New Region(gp)
|
|
||||||
|
|
||||||
containerPanel.Controls.Add(PointButtons(i))
|
PointButtons(i).BackColor = Color.FromArgb(50, Color.Red)
|
||||||
|
PointButtons(i).FlatStyle = FlatStyle.Flat
|
||||||
|
PointButtons(i).FlatAppearance.BorderSize = 0
|
||||||
|
PointButtons(i).FlatAppearance.MouseOverBackColor = Color.Red
|
||||||
|
PointButtons(i).FlatAppearance.MouseDownBackColor = Color.DarkRed
|
||||||
|
|
||||||
AddHandler PointButtons(i).Click, AddressOf PointButton_Click
|
Dim gp As New Drawing.Drawing2D.GraphicsPath
|
||||||
Next
|
gp.AddEllipse(New Rectangle(New Point(0, 0), New Size(30, 30)))
|
||||||
|
PointButtons(i).Region = New Region(gp)
|
||||||
|
|
||||||
angleCounter = angleCounter + 1
|
containerPanel.Controls.Add(PointButtons(i))
|
||||||
|
|
||||||
|
AddHandler PointButtons(i).Click, AddressOf PointButton_Click
|
||||||
|
Next
|
||||||
|
|
||||||
|
angleCounter = angleCounter + 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' --- When a point button for angle recess is pressed ---
|
' --- When a point button for angle recess is pressed ---
|
||||||
|
|
@ -330,6 +339,12 @@ Public Class GUI
|
||||||
|
|
||||||
'Redraw grating
|
'Redraw grating
|
||||||
Me.Refresh()
|
Me.Refresh()
|
||||||
|
|
||||||
|
RemoveHandler Me.Controls("X_TextBox").TextChanged, AddressOf AngleText_Changed
|
||||||
|
Me.Controls.RemoveByKey("X_TextBox")
|
||||||
|
|
||||||
|
RemoveHandler Me.Controls("Y_TextBox").TextChanged, AddressOf AngleText_Changed
|
||||||
|
Me.Controls.RemoveByKey("Y_TextBox")
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' --- When export to SW button is pressed ---
|
' --- When export to SW button is pressed ---
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue