Functions for add angle

This commit is contained in:
Mans 2021-02-01 15:03:59 +01:00
parent 953e569533
commit 37a2511b65
1 changed files with 52 additions and 37 deletions

View File

@ -229,24 +229,28 @@ 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)
End Sub
Private Sub Create_TextBox(TextBoxName As String, TextBoxText As String, TextBoxLeft As Integer, TextBoxTop As Integer, TextBoxWidth As Integer)
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
Private Sub AngleText_Changed(sender As TextBox, e As EventArgs)
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 ' Create Buttons for all clickable points
For i = 0 To pointsOrder.Count - 1 For i = 0 To pointsOrder.Count - 1
PointButtons.Add(New Button) PointButtons.Add(New Button)
@ -276,6 +280,11 @@ Public Class GUI
Next Next
angleCounter = angleCounter + 1 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 ---