From 953e569533225d9568bbbc783dbe4a4fb09bb168 Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 1 Feb 2021 14:09:13 +0100 Subject: [PATCH] Controls the flow of the GUI --- Wardrobe/GUI.Designer.vb | 243 ++++++++++++++++++++++++++------------- Wardrobe/GUI.vb | 75 +++++++++--- 2 files changed, 221 insertions(+), 97 deletions(-) diff --git a/Wardrobe/GUI.Designer.vb b/Wardrobe/GUI.Designer.vb index 6a7f3ae..55600de 100644 --- a/Wardrobe/GUI.Designer.vb +++ b/Wardrobe/GUI.Designer.vb @@ -25,15 +25,11 @@ Partial Class GUI Me.components = New System.ComponentModel.Container() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(GUI)) Me.DrawingPanel = New System.Windows.Forms.Panel() - Me.LengthBox = New System.Windows.Forms.TextBox() - Me.WidthBox = New System.Windows.Forms.TextBox() Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.ExportSWButton = New System.Windows.Forms.Button() Me.AngleButton = New System.Windows.Forms.Button() - Me.AngleD1 = New System.Windows.Forms.TextBox() - Me.AngleD2 = New System.Windows.Forms.TextBox() Me.LabelAngleX = New System.Windows.Forms.Label() Me.LabelAngleY = New System.Windows.Forms.Label() Me.SettingsButton = New System.Windows.Forms.Button() @@ -41,37 +37,25 @@ Partial Class GUI Me.ComboBox_MeshSize = New System.Windows.Forms.ComboBox() Me.ComboBox_Thickness = New System.Windows.Forms.ComboBox() Me.ComboBox_Height = New System.Windows.Forms.ComboBox() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.Label5 = New System.Windows.Forms.Label() + Me.Label6 = New System.Windows.Forms.Label() + Me.Label7 = New System.Windows.Forms.Label() + Me.Label8 = New System.Windows.Forms.Label() + Me.ComboBox_Width = New System.Windows.Forms.ComboBox() + Me.ComboBox_Length = New System.Windows.Forms.ComboBox() Me.SuspendLayout() ' 'DrawingPanel ' Me.DrawingPanel.BackColor = System.Drawing.SystemColors.Window - Me.DrawingPanel.Location = New System.Drawing.Point(319, 117) - Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) + Me.DrawingPanel.Location = New System.Drawing.Point(239, 95) + Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2) Me.DrawingPanel.Name = "DrawingPanel" - Me.DrawingPanel.Size = New System.Drawing.Size(865, 484) + Me.DrawingPanel.Size = New System.Drawing.Size(905, 540) Me.DrawingPanel.TabIndex = 0 ' - 'LengthBox - ' - Me.LengthBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.LengthBox.Location = New System.Drawing.Point(671, 63) - Me.LengthBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) - Me.LengthBox.Name = "LengthBox" - Me.LengthBox.Size = New System.Drawing.Size(100, 26) - Me.LengthBox.TabIndex = 1 - Me.LengthBox.Text = "1200" - ' - 'WidthBox - ' - Me.WidthBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.WidthBox.Location = New System.Drawing.Point(457, 63) - Me.WidthBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) - Me.WidthBox.Name = "WidthBox" - Me.WidthBox.Size = New System.Drawing.Size(100, 26) - Me.WidthBox.TabIndex = 2 - Me.WidthBox.Text = "1200" - ' 'ContextMenuStrip1 ' Me.ContextMenuStrip1.ImageScalingSize = New System.Drawing.Size(20, 20) @@ -82,10 +66,9 @@ Partial Class GUI ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label1.Location = New System.Drawing.Point(398, 66) - Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.Label1.Location = New System.Drawing.Point(303, 25) Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(52, 20) + Me.Label1.Size = New System.Drawing.Size(44, 17) Me.Label1.TabIndex = 4 Me.Label1.Text = "Width" ' @@ -93,57 +76,41 @@ Partial Class GUI ' Me.Label2.AutoSize = True Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label2.Location = New System.Drawing.Point(604, 65) - Me.Label2.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.Label2.Location = New System.Drawing.Point(292, 58) Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(60, 20) + Me.Label2.Size = New System.Drawing.Size(52, 17) Me.Label2.TabIndex = 5 Me.Label2.Text = "Length" ' 'ExportSWButton ' Me.ExportSWButton.BackColor = System.Drawing.SystemColors.ActiveCaption - Me.ExportSWButton.Location = New System.Drawing.Point(987, 61) + Me.ExportSWButton.Location = New System.Drawing.Point(1052, 643) + Me.ExportSWButton.Margin = New System.Windows.Forms.Padding(2) Me.ExportSWButton.Name = "ExportSWButton" - Me.ExportSWButton.Size = New System.Drawing.Size(75, 31) + Me.ExportSWButton.Size = New System.Drawing.Size(92, 33) Me.ExportSWButton.TabIndex = 6 Me.ExportSWButton.Text = "Export" Me.ExportSWButton.UseVisualStyleBackColor = False ' 'AngleButton ' - Me.AngleButton.Location = New System.Drawing.Point(43, 343) + Me.AngleButton.Location = New System.Drawing.Point(11, 147) + Me.AngleButton.Margin = New System.Windows.Forms.Padding(2) Me.AngleButton.Name = "AngleButton" - Me.AngleButton.Size = New System.Drawing.Size(122, 34) + Me.AngleButton.Size = New System.Drawing.Size(92, 28) Me.AngleButton.TabIndex = 7 Me.AngleButton.Text = "Add Angle" Me.AngleButton.UseVisualStyleBackColor = True ' - 'AngleD1 - ' - Me.AngleD1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.AngleD1.Location = New System.Drawing.Point(57, 405) - Me.AngleD1.Name = "AngleD1" - Me.AngleD1.Size = New System.Drawing.Size(82, 26) - Me.AngleD1.TabIndex = 8 - Me.AngleD1.Text = "50" - ' - 'AngleD2 - ' - Me.AngleD2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.AngleD2.Location = New System.Drawing.Point(201, 405) - Me.AngleD2.Name = "AngleD2" - Me.AngleD2.Size = New System.Drawing.Size(90, 26) - Me.AngleD2.TabIndex = 9 - Me.AngleD2.Text = "50" - ' 'LabelAngleX ' Me.LabelAngleX.AutoSize = True Me.LabelAngleX.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.LabelAngleX.Location = New System.Drawing.Point(31, 408) + Me.LabelAngleX.Location = New System.Drawing.Point(12, 192) + Me.LabelAngleX.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) Me.LabelAngleX.Name = "LabelAngleX" - Me.LabelAngleX.Size = New System.Drawing.Size(20, 20) + Me.LabelAngleX.Size = New System.Drawing.Size(17, 17) Me.LabelAngleX.TabIndex = 10 Me.LabelAngleX.Text = "X" ' @@ -151,80 +118,186 @@ Partial Class GUI ' Me.LabelAngleY.AutoSize = True Me.LabelAngleY.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.LabelAngleY.Location = New System.Drawing.Point(176, 408) + Me.LabelAngleY.Location = New System.Drawing.Point(121, 192) + Me.LabelAngleY.Margin = New System.Windows.Forms.Padding(2, 0, 2, 0) Me.LabelAngleY.Name = "LabelAngleY" - Me.LabelAngleY.Size = New System.Drawing.Size(19, 20) + Me.LabelAngleY.Size = New System.Drawing.Size(17, 17) Me.LabelAngleY.TabIndex = 11 Me.LabelAngleY.Text = "Y" ' 'SettingsButton ' - Me.SettingsButton.Location = New System.Drawing.Point(1104, 12) + Me.SettingsButton.Location = New System.Drawing.Point(11, 635) + Me.SettingsButton.Margin = New System.Windows.Forms.Padding(2) Me.SettingsButton.Name = "SettingsButton" - Me.SettingsButton.Size = New System.Drawing.Size(80, 50) + Me.SettingsButton.Size = New System.Drawing.Size(60, 41) Me.SettingsButton.TabIndex = 12 Me.SettingsButton.Text = "Settings" Me.SettingsButton.UseVisualStyleBackColor = True ' 'ComboBox_TypeChooser ' + Me.ComboBox_TypeChooser.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.ComboBox_TypeChooser.FormattingEnabled = True Me.ComboBox_TypeChooser.Items.AddRange(New Object() {"Pressure Welded", "Type A"}) - Me.ComboBox_TypeChooser.Location = New System.Drawing.Point(43, 147) + Me.ComboBox_TypeChooser.Location = New System.Drawing.Point(107, 25) + Me.ComboBox_TypeChooser.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_TypeChooser.Name = "ComboBox_TypeChooser" - Me.ComboBox_TypeChooser.Size = New System.Drawing.Size(187, 24) + Me.ComboBox_TypeChooser.Size = New System.Drawing.Size(141, 21) Me.ComboBox_TypeChooser.TabIndex = 13 + Me.ComboBox_TypeChooser.Tag = "" ' 'ComboBox_MeshSize ' + Me.ComboBox_MeshSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBox_MeshSize.Enabled = False Me.ComboBox_MeshSize.FormattingEnabled = True Me.ComboBox_MeshSize.Items.AddRange(New Object() {"12x100 (B9)", "25x50 (F4)", "34x37 (H3)"}) - Me.ComboBox_MeshSize.Location = New System.Drawing.Point(43, 186) + Me.ComboBox_MeshSize.Location = New System.Drawing.Point(107, 58) + Me.ComboBox_MeshSize.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_MeshSize.Name = "ComboBox_MeshSize" - Me.ComboBox_MeshSize.Size = New System.Drawing.Size(187, 24) + Me.ComboBox_MeshSize.Size = New System.Drawing.Size(141, 21) Me.ComboBox_MeshSize.TabIndex = 14 ' 'ComboBox_Thickness ' + Me.ComboBox_Thickness.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBox_Thickness.Enabled = False Me.ComboBox_Thickness.FormattingEnabled = True Me.ComboBox_Thickness.Items.AddRange(New Object() {"2", "3", "4"}) - Me.ComboBox_Thickness.Location = New System.Drawing.Point(43, 230) + Me.ComboBox_Thickness.Location = New System.Drawing.Point(596, 21) + Me.ComboBox_Thickness.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_Thickness.Name = "ComboBox_Thickness" - Me.ComboBox_Thickness.Size = New System.Drawing.Size(187, 24) + Me.ComboBox_Thickness.Size = New System.Drawing.Size(141, 21) Me.ComboBox_Thickness.TabIndex = 15 ' 'ComboBox_Height ' + Me.ComboBox_Height.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBox_Height.Enabled = False Me.ComboBox_Height.FormattingEnabled = True Me.ComboBox_Height.Items.AddRange(New Object() {"20", "25", "30"}) - Me.ComboBox_Height.Location = New System.Drawing.Point(43, 266) + Me.ComboBox_Height.Location = New System.Drawing.Point(596, 55) + Me.ComboBox_Height.Margin = New System.Windows.Forms.Padding(2) Me.ComboBox_Height.Name = "ComboBox_Height" - Me.ComboBox_Height.Size = New System.Drawing.Size(187, 24) + Me.ComboBox_Height.Size = New System.Drawing.Size(141, 21) Me.ComboBox_Height.TabIndex = 16 ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label3.Location = New System.Drawing.Point(62, 24) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(40, 17) + Me.Label3.TabIndex = 17 + Me.Label3.Text = "Type" + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label4.Location = New System.Drawing.Point(29, 59) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(73, 17) + Me.Label4.TabIndex = 18 + Me.Label4.Text = "Mesh Size" + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label5.Location = New System.Drawing.Point(519, 22) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(72, 17) + Me.Label5.TabIndex = 19 + Me.Label5.Text = "Thickness" + ' + 'Label6 + ' + Me.Label6.AutoSize = True + Me.Label6.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label6.Location = New System.Drawing.Point(542, 55) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(49, 17) + Me.Label6.TabIndex = 20 + Me.Label6.Text = "Height" + ' + 'Label7 + ' + Me.Label7.AutoSize = True + Me.Label7.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label7.Location = New System.Drawing.Point(8, 107) + Me.Label7.Name = "Label7" + Me.Label7.Size = New System.Drawing.Size(78, 17) + Me.Label7.TabIndex = 21 + Me.Label7.Text = "Recesses" + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.BackColor = System.Drawing.Color.Black + Me.Label8.Font = New System.Drawing.Font("Microsoft Sans Serif", 1.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label8.Location = New System.Drawing.Point(10, 134) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(173, 2) + Me.Label8.TabIndex = 22 + Me.Label8.Text = " " & + " " & + " " + ' + 'ComboBox_Width + ' + Me.ComboBox_Width.Enabled = False + Me.ComboBox_Width.FormattingEnabled = True + Me.ComboBox_Width.Items.AddRange(New Object() {"500", "700", "722", "1000"}) + Me.ComboBox_Width.Location = New System.Drawing.Point(352, 25) + Me.ComboBox_Width.Margin = New System.Windows.Forms.Padding(2) + Me.ComboBox_Width.Name = "ComboBox_Width" + Me.ComboBox_Width.Size = New System.Drawing.Size(141, 21) + Me.ComboBox_Width.TabIndex = 23 + Me.ComboBox_Width.Text = "1000" + ' + 'ComboBox_Length + ' + Me.ComboBox_Length.Enabled = False + Me.ComboBox_Length.FormattingEnabled = True + Me.ComboBox_Length.Items.AddRange(New Object() {"300", "600", "900", "1000"}) + Me.ComboBox_Length.Location = New System.Drawing.Point(352, 58) + Me.ComboBox_Length.Margin = New System.Windows.Forms.Padding(2) + Me.ComboBox_Length.Name = "ComboBox_Length" + Me.ComboBox_Length.Size = New System.Drawing.Size(141, 21) + Me.ComboBox_Length.TabIndex = 24 + Me.ComboBox_Length.Text = "1000" + ' 'GUI ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(1199, 614) - Me.Controls.Add(Me.ComboBox_Height) - Me.Controls.Add(Me.ComboBox_Thickness) + Me.ClientSize = New System.Drawing.Size(1155, 687) + Me.Controls.Add(Me.ComboBox_Length) + Me.Controls.Add(Me.ComboBox_Width) Me.Controls.Add(Me.ComboBox_MeshSize) Me.Controls.Add(Me.ComboBox_TypeChooser) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.Label8) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.Label7) + Me.Controls.Add(Me.Label6) + Me.Controls.Add(Me.Label5) Me.Controls.Add(Me.SettingsButton) + Me.Controls.Add(Me.ExportSWButton) + Me.Controls.Add(Me.ComboBox_Height) + Me.Controls.Add(Me.ComboBox_Thickness) Me.Controls.Add(Me.LabelAngleY) Me.Controls.Add(Me.LabelAngleX) - Me.Controls.Add(Me.AngleD2) - Me.Controls.Add(Me.AngleD1) Me.Controls.Add(Me.AngleButton) - Me.Controls.Add(Me.ExportSWButton) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.WidthBox) - Me.Controls.Add(Me.LengthBox) Me.Controls.Add(Me.DrawingPanel) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) - Me.Margin = New System.Windows.Forms.Padding(4) + Me.MaximizeBox = False Me.Name = "GUI" Me.Text = "Floor Gratings" Me.ResumeLayout(False) @@ -233,15 +306,11 @@ Partial Class GUI End Sub Friend WithEvents DrawingPanel As Panel - Friend WithEvents LengthBox As TextBox - Friend WithEvents WidthBox As TextBox Friend WithEvents ContextMenuStrip1 As ContextMenuStrip Friend WithEvents Label1 As Label Friend WithEvents Label2 As Label Friend WithEvents ExportSWButton As Button Friend WithEvents AngleButton As Button - Friend WithEvents AngleD1 As TextBox - Friend WithEvents AngleD2 As TextBox Friend WithEvents LabelAngleX As Label Friend WithEvents LabelAngleY As Label Friend WithEvents SettingsButton As Button @@ -249,4 +318,12 @@ Partial Class GUI Friend WithEvents ComboBox_MeshSize As ComboBox Friend WithEvents ComboBox_Thickness As ComboBox Friend WithEvents ComboBox_Height As ComboBox + Friend WithEvents Label3 As Label + Friend WithEvents Label4 As Label + Friend WithEvents Label5 As Label + Friend WithEvents Label6 As Label + Friend WithEvents Label7 As Label + Friend WithEvents Label8 As Label + Friend WithEvents ComboBox_Width As ComboBox + Friend WithEvents ComboBox_Length As ComboBox End Class diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index d80869b..25ca540 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -5,6 +5,7 @@ Public Class GUI Dim HLCtFolder As String = "C:\Users\Anton\Documents\Exjobb\X2021" Dim containerPanel As Panel + Dim containerX, containerY, containerW, containerH, containerMidX, containerMidY As Integer Dim gratingMaxL As Decimal = 1200 Dim gratingMaxW As Decimal = 1200 @@ -138,19 +139,46 @@ Public Class GUI Program.Update_KB() End Sub - Private Sub WidthBox_TextChanged(sender As Object, e As EventArgs) Handles WidthBox.TextChanged - If WidthBox.Text <> "" Then - If CDec(WidthBox.Text) > 0 Then - gratingMaxW = CDec(WidthBox.Text) + Private Sub WidthB_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Width.TextChanged + If ComboBox_Width.Text <> "" Then + If CDec(ComboBox_Width.Text) > 0 Then + gratingMaxW = CDec(ComboBox_Width.Text) Update_GratingDimensions() End If End If End Sub - Private Sub LengthBox_TextChanged(sender As Object, e As EventArgs) Handles LengthBox.TextChanged - If LengthBox.Text <> "" Then - If CDec(LengthBox.Text) > 0 Then - gratingMaxL = CDec(LengthBox.Text) + Private Sub ComboBox_TypeChooser_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_TypeChooser.TextChanged + ComboBox_MeshSize.Enabled = True + ComboBox_MeshSize.Items.Clear() + Dim gratingType As String = ComboBox_TypeChooser.Text + If gratingType = "Pressure Welded" Then + ComboBox_MeshSize.Items.Add("12x100 (B9)") 'Tillfällig + ComboBox_MeshSize.Items.Add("25x50 (F4)") 'Tillfällig + ComboBox_MeshSize.Items.Add("34x37 (H3)") 'Tillfällig + + For i = 1 To 5 + ComboBox_MeshSize.Items.Add("hej " & i) 'Hämta från databas + Next + Else + For i = 1 To 5 + ComboBox_MeshSize.Items.Add("Test " & i) 'Hämta från databas + Next + End If + End Sub + + Private Sub ComboBox_MeshSize_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_MeshSize.TextChanged + ComboBox_Width.Enabled = True + ComboBox_Length.Enabled = True + ComboBox_Thickness.Enabled = True + ComboBox_Height.Enabled = True + ' Uppdatera fälten med avseende på mesh size + End Sub + + Private Sub LengthBox_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Length.TextChanged + If ComboBox_Length.Text <> "" Then + If CDec(ComboBox_Length.Text) > 0 Then + gratingMaxL = CDec(ComboBox_Length.Text) Update_GratingDimensions() End If End If @@ -200,6 +228,25 @@ Public Class GUI ' --- When angle button is pressed --- Private Sub AngleButton_Click(sender As Object, e As EventArgs) Handles AngleButton.Click + ' Add TextBoxes with Labels + Dim XValueBox As New TextBox + XValueBox.Name = "X_TextBox" + XValueBox.Text = "50" + XValueBox.Left = 32 + 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 For i = 0 To pointsOrder.Count - 1 PointButtons.Add(New Button) @@ -243,10 +290,10 @@ Public Class GUI Dim pXSW As Decimal = points(pointPressed)(2) Dim pYSW As Decimal = points(pointPressed)(3) - Dim d1P As Decimal = AngleD1.Text / scaleDiff - Dim d2P As Decimal = AngleD2.Text / scaleDiff - Dim d1SW As Decimal = AngleD1.Text / 1000 - Dim d2SW As Decimal = AngleD2.Text / 1000 + Dim d1P As Decimal = Me.Controls("X_TextBox").Text / scaleDiff + Dim d2P As Decimal = Me.Controls("Y_TextBox").Text / scaleDiff + Dim d1SW As Decimal = Me.Controls("X_TextBox").Text / 1000 + Dim d2SW As Decimal = Me.Controls("Y_TextBox").Text / 1000 If pXP < containerMidX Then If pYP > containerMidY Then @@ -321,8 +368,8 @@ Public Class GUI gratingTable.Rows.Add() gratingTable.Rows(0)("SERRATED") = False 'Hämta från GUI - gratingTable.Rows(0)("WIDTH") = CDec(WidthBox.Text) - gratingTable.Rows(0)("LENGTH") = CDec(LengthBox.Text) + gratingTable.Rows(0)("WIDTH") = CDec(ComboBox_Width.Text) + gratingTable.Rows(0)("LENGTH") = CDec(ComboBox_Length.Text) gratingTable.Rows(0)("LOADBAR_THICKNESS") = CDec(ComboBox_Thickness.Text) gratingTable.Rows(0)("LOADBAR_HEIGHT") = CDec(ComboBox_Height.Text) gratingTable.Rows(0)("LOADBAR_SPACING") = CDec(lSpacing)