Added whole mesh widths and how they are handled in the GUI

This commit is contained in:
Anton 2021-02-09 14:29:02 +01:00
parent 0233d1b758
commit cd1fa017c5
6 changed files with 113 additions and 94 deletions

Binary file not shown.

View File

@ -41,12 +41,12 @@ Partial Class GUI
Me.Label6 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.ComboBox_Width = New System.Windows.Forms.ComboBox()
Me.ComboBox_Length = New System.Windows.Forms.ComboBox()
Me.Button_Square = New System.Windows.Forms.Button()
Me.Label9 = New System.Windows.Forms.Label()
Me.ComboBox_Material = New System.Windows.Forms.ComboBox()
Me.Label_Material = New System.Windows.Forms.Label()
Me.CheckBox_WholeMeshWidths = New System.Windows.Forms.CheckBox()
Me.TextBox_Length = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'DrawingPanel
@ -232,17 +232,6 @@ Partial Class GUI
Me.ComboBox_Width.Size = New System.Drawing.Size(187, 24)
Me.ComboBox_Width.TabIndex = 23
'
'ComboBox_Length
'
Me.ComboBox_Length.Enabled = False
Me.ComboBox_Length.FormattingEnabled = True
Me.ComboBox_Length.Items.AddRange(New Object() {"300", "600", "900", "1000", "3000"})
Me.ComboBox_Length.Location = New System.Drawing.Point(125, 566)
Me.ComboBox_Length.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2)
Me.ComboBox_Length.Name = "ComboBox_Length"
Me.ComboBox_Length.Size = New System.Drawing.Size(187, 24)
Me.ComboBox_Length.TabIndex = 24
'
'Button_Square
'
Me.Button_Square.Location = New System.Drawing.Point(971, 68)
@ -300,11 +289,20 @@ Partial Class GUI
Me.CheckBox_WholeMeshWidths.UseCompatibleTextRendering = True
Me.CheckBox_WholeMeshWidths.UseVisualStyleBackColor = True
'
'TextBox_Length
'
Me.TextBox_Length.Enabled = False
Me.TextBox_Length.Location = New System.Drawing.Point(125, 566)
Me.TextBox_Length.Name = "TextBox_Length"
Me.TextBox_Length.Size = New System.Drawing.Size(187, 22)
Me.TextBox_Length.TabIndex = 30
'
'GUI
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1845, 937)
Me.Controls.Add(Me.TextBox_Length)
Me.Controls.Add(Me.AngleButton)
Me.Controls.Add(Me.Button_Square)
Me.Controls.Add(Me.Label7)
@ -312,7 +310,6 @@ Partial Class GUI
Me.Controls.Add(Me.ComboBox_Material)
Me.Controls.Add(Me.Label_Material)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.ComboBox_Length)
Me.Controls.Add(Me.ComboBox_Width)
Me.Controls.Add(Me.ComboBox_MeshSize)
Me.Controls.Add(Me.ComboBox_TypeChooser)
@ -355,10 +352,10 @@ Partial Class GUI
Friend WithEvents Label6 As Label
Friend WithEvents Label7 As Label
Friend WithEvents ComboBox_Width As ComboBox
Friend WithEvents ComboBox_Length As ComboBox
Friend WithEvents Button_Square As Button
Friend WithEvents Label9 As Label
Friend WithEvents ComboBox_Material As ComboBox
Friend WithEvents Label_Material As Label
Friend WithEvents CheckBox_WholeMeshWidths As CheckBox
Friend WithEvents TextBox_Length As TextBox
End Class

View File

@ -28,7 +28,7 @@ Public Class GUI
Private Sub Get_Database()
excelWB = excelApp.Workbooks.Open(GUI_Settings.HLCtFolder & "\Databas.xlsx")
For i = 1 To 3 'excelWB.Worksheets.Count
For i = 1 To 4 'excelWB.Worksheets.Count
Dim activeSheet As Excel.Worksheet
activeSheet = excelWB.Sheets(i)
@ -36,31 +36,39 @@ Public Class GUI
Dim numOfColumns As Integer = 0
Dim columnCounter As Integer = 1
Dim rowCounter As Integer
Dim rowValue As String
Dim longestRow As Integer = 0
Dim columnName As String = activeSheet.Cells(1, columnCounter).Value
While columnName <> ""
tempDT.Columns.Add(columnName, GetType(String))
rowCounter = 2
rowValue = activeSheet.Cells(rowCounter, numOfColumns + 1).Value
While rowValue <> ""
rowCounter = rowCounter + 1
rowValue = activeSheet.Cells(rowCounter, numOfColumns + 1).Value
End While
If rowCounter > longestRow Then
longestRow = rowCounter
End If
columnCounter = columnCounter + 1
columnName = activeSheet.Cells(1, columnCounter).Value
numOfColumns = numOfColumns + 1
End While
Dim rowCounter As Integer = 2
Dim rowValue As String = activeSheet.Cells(rowCounter, 1).Value
While rowValue <> ""
For j = 2 To longestRow - 1
tempDT.Rows.Add()
For j = 0 To numOfColumns - 1
tempDT.Rows(tempDT.Rows.Count - 1)(j) = activeSheet.Cells(rowCounter, j + 1).Value
For k = 0 To numOfColumns - 1
tempDT.Rows(tempDT.Rows.Count - 1)(k) = activeSheet.Cells(j, k + 1).Value
Next
rowCounter = rowCounter + 1
rowValue = activeSheet.Cells(rowCounter, 1).Value
End While
Next
dataBase.Add(activeSheet.Name, tempDT)
System.Runtime.InteropServices.Marshal.ReleaseComObject(activeSheet)
Next
' HANTERA OLIKA LÄNGDER COLUMNER
excelWB.Close()
excelApp.Quit()
@ -68,7 +76,8 @@ Public Class GUI
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp)
End Sub
Public Sub Create_TextBox(TextBoxName As String, TextBoxText As String, TextBoxLeft As Integer, TextBoxTop As Integer, TextBoxWidth As Integer)
Public 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
@ -117,7 +126,9 @@ Public Class GUI
GUI_Gratings_Data.ThicknessChanged(sender, e)
End Sub
Private Sub CheckBox_WholeMeshWidths_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox_WholeMeshWidths.CheckedChanged
Private Sub CheckBox_WholeMeshWidths_CheckedChanged(sender As Object, e As EventArgs) _
Handles CheckBox_WholeMeshWidths.CheckedChanged
GUI_Gratings_Data.WholeMeshWidthsChanged(sender, e)
End Sub
@ -132,12 +143,12 @@ Public Class GUI
End Sub
' --- Grating length changed ---
Private Sub LengthBox_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Length.TextChanged
Private Sub LengthBox_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Length.TextChanged
GUI_Gratings_Data.LengthChanged(sender, e)
End Sub
' --- Check if length is a number ---
Private Sub ComboBox_Length_KeyPress(sender As Object, e As KeyPressEventArgs) Handles ComboBox_Length.KeyPress
Private Sub ComboBox_Length_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox_Length.KeyPress
GUI_Gratings_Data.Check_IfNumber(e)
End Sub

View File

@ -163,12 +163,14 @@
' Draw grating direction symbol
Dim symPen As Pen = New Pen(Color.Black, 1)
For i = 1 To DirSymbolPoints.Count - 1
e.Graphics.DrawLine(symPen, DirSymbolPoints("p" & i)(0), DirSymbolPoints("p" & i)(1), DirSymbolPoints("p" & i + 1)(0), DirSymbolPoints("p" & i + 1)(1))
e.Graphics.DrawLine(symPen, DirSymbolPoints("p" & i)(0), DirSymbolPoints("p" & i)(1),
DirSymbolPoints("p" & i + 1)(0), DirSymbolPoints("p" & i + 1)(1))
Next
' Draw arrow symbol
For i = 1 To ArrowSymbolPoints.Count - 1
e.Graphics.DrawLine(symPen, ArrowSymbolPoints("p" & i)(0), ArrowSymbolPoints("p" & i)(1), ArrowSymbolPoints("p" & i + 1)(0), ArrowSymbolPoints("p" & i + 1)(1))
e.Graphics.DrawLine(symPen, ArrowSymbolPoints("p" & i)(0), ArrowSymbolPoints("p" & i)(1),
ArrowSymbolPoints("p" & i + 1)(0), ArrowSymbolPoints("p" & i + 1)(1))
Next
e.Graphics.TranslateTransform(20, containerW - 20)
e.Graphics.DrawString("Length", New Font("Microsoft Sans Serif", 8), Brushes.Black, New Point(45, -7))

View File

@ -90,7 +90,8 @@
' Remove point buttons
For i = 0 To GUI_Drawing_Panel.pointsOrder.Count - 1
If pointsFunc(GUI_Drawing_Panel.pointsOrder(i)) Then
RemoveHandler GUI.DrawingPanel.Controls(GUI_Drawing_Panel.pointsOrder(i) & "_Button").Click, AddressOf PointButton_Click
RemoveHandler GUI.DrawingPanel.Controls(GUI_Drawing_Panel.pointsOrder(i) & "_Button").Click,
AddressOf PointButton_Click
GUI.DrawingPanel.Controls.RemoveByKey(GUI_Drawing_Panel.pointsOrder(i) & "_Button")
End If
Next

View File

@ -85,7 +85,9 @@
End If
If lacqueredCheckBoxBol = False AndAlso (gratingMaterial = "Hot dip galvanized steel" OrElse gratingMaterial = "Untreated") Then
If lacqueredCheckBoxBol = False AndAlso (gratingMaterial = "Hot dip galvanized steel" _
OrElse gratingMaterial = "Untreated") Then
lacqueredCheckBox.Name = "CheckBox_Lacquered"
lacqueredCheckBox.Text = "Lacquered"
lacqueredCheckBox.Left = 115
@ -93,7 +95,9 @@
AddHandler lacqueredCheckBox.CheckedChanged, AddressOf CheckBox_Lacquered_CheckedChanged
GUI.Controls.Add(lacqueredCheckBox)
lacqueredCheckBoxBol = True
ElseIf lacqueredCheckBoxBol = True AndAlso gratingMaterial <> "Hot dip galvanized steel" AndAlso gratingMaterial <> "Untreated" Then
ElseIf lacqueredCheckBoxBol = True AndAlso gratingMaterial <> "Hot dip galvanized steel" _
AndAlso gratingMaterial <> "Untreated" Then
RemoveHandler lacqueredCheckBox.CheckedChanged, AddressOf CheckBox_Lacquered_CheckedChanged
GUI.Controls.RemoveByKey("CheckBox_Lacquered")
lacqueredCheckBoxBol = False
@ -140,7 +144,8 @@
For i = 0 To meshesDT.Rows.Count - 1
If gratingSerrated = serratedInDT AndAlso gratingMaterial = materialInDT AndAlso gratingType = typeInDT Then
Dim item As String
item = meshesDT.Rows(i)("LB-SPACING") & "x" & meshesDT.Rows(i)("CB-SPACING") & " (" & meshesDT.Rows(i)("NAME") & ")"
item = meshesDT.Rows(i)("LB-SPACING") & "x" & meshesDT.Rows(i)("CB-SPACING") &
" (" & meshesDT.Rows(i)("NAME") & ")"
Dim addItem As Boolean = True
For j = 0 To GUI.ComboBox_MeshSize.Items.Count - 1
@ -238,7 +243,8 @@
For i = 0 To meshesDT.Rows.Count - 1
If gratingName = nameInDT AndAlso loadBarSpacing = LBSpacingInDT AndAlso crossBarSpacing = CBSpacingInDT _
AndAlso gratingSerrated = serratedInDT AndAlso gratingMaterial = materialInDT AndAlso gratingHeight = HeightInDT Then
AndAlso gratingSerrated = serratedInDT AndAlso gratingMaterial = materialInDT _
AndAlso gratingHeight = HeightInDT Then
Dim addItem As Boolean = True
For j = 0 To tempList.Count - 1
@ -270,27 +276,6 @@
End Sub
Public Shared Sub ThicknessChanged(sender As Object, e As EventArgs)
GUI.ComboBox_Width.Enabled = True
GUI.ComboBox_Width.Items.Clear()
GUI.ComboBox_Length.Enabled = True
GUI.ComboBox_Length.Items.Clear()
GUI.CheckBox_WholeMeshWidths.Enabled = True
loadBarThickness = CInt(GUI.ComboBox_Thickness.Text)
' Add Widths
GUI.ComboBox_Width.Items.Add("300")
GUI.ComboBox_Width.Items.Add("500")
GUI.ComboBox_Width.Items.Add("1000")
GUI.ComboBox_Width.Text = GUI.ComboBox_Width.Items(0)
' Add Length
GUI.ComboBox_Length.Items.Add("500")
GUI.ComboBox_Length.Items.Add("1000")
GUI.ComboBox_Length.Text = GUI.ComboBox_Length.Items(0)
End Sub
Public Shared Sub WholeMeshWidthsChanged(sender As Object, e As EventArgs)
If sender.Checked Then
GUI.ComboBox_Width.DropDownStyle = ComboBoxStyle.DropDownList
@ -299,32 +284,74 @@
End If
End Sub
Public Shared Sub WidthChanged(sender As Object, e As EventArgs)
Public Shared Sub ThicknessChanged(sender As Object, e As EventArgs)
GUI.ComboBox_Width.Enabled = True
GUI.ComboBox_Width.Items.Clear()
GUI.TextBox_Length.Text = 1000
GUI.TextBox_Length.Enabled = True
GUI.CheckBox_WholeMeshWidths.Enabled = True
loadBarThickness = CInt(GUI.ComboBox_Thickness.Text)
Dim meshesDT As DataTable = GUI.dataBase("Meshes")
Dim nameInDT As String = meshesDT.Rows(0)("NAME")
Dim materialInDT As String = meshesDT.Rows(0)("MATERIAL")
Dim serratedInDT As Boolean = CBool(meshesDT.Rows(0)("SERRATED"))
Dim LBSpacingInDT As Integer = CInt(meshesDT.Rows(0)("LB-SPACING"))
Dim CBSpacingInDT As Integer = CInt(meshesDT.Rows(0)("CB-SPACING"))
Dim HeightInDT As Integer = CInt(meshesDT.Rows(0)("LB-HEIGHT"))
Dim ThicknessInDT As Integer = CInt(meshesDT.Rows(0)("LB-THICKNESS"))
Dim wholeMeshesColumn As String = ""
For i = 0 To meshesDT.Rows.Count - 1
If gratingName = nameInDT AndAlso loadBarSpacing = LBSpacingInDT AndAlso crossBarSpacing = CBSpacingInDT _
AndAlso gratingSerrated = serratedInDT AndAlso gratingMaterial = materialInDT _
AndAlso gratingHeight = HeightInDT AndAlso loadBarThickness = ThicknessInDT Then
wholeMeshesColumn = meshesDT.Rows(i)("WHOLE MESHES")
Exit For
End If
Try
nameInDT = meshesDT.Rows(i + 1)("NAME")
materialInDT = meshesDT.Rows(i + 1)("MATERIAL")
serratedInDT = CBool(meshesDT.Rows(i + 1)("SERRATED"))
LBSpacingInDT = CInt(meshesDT.Rows(i + 1)("LB-SPACING"))
CBSpacingInDT = CInt(meshesDT.Rows(i + 1)("CB-SPACING"))
HeightInDT = CInt(meshesDT.Rows(i + 1)("LB-HEIGHT"))
ThicknessInDT = CInt(meshesDT.Rows(i + 1)("LB-THICKNESS"))
Catch ex As Exception
End Try
Next
Dim wholeMeshesDT As DataTable = GUI.dataBase("Whole Meshes")
For i = 0 To wholeMeshesDT.Rows.Count - 1
If Not IsDBNull(wholeMeshesDT.Rows(i)(wholeMeshesColumn)) Then
GUI.ComboBox_Width.Items.Add(wholeMeshesDT.Rows(i)(wholeMeshesColumn))
End If
Next
End Sub
Public Shared Sub WidthChanged(sender As Object, e As EventArgs)
If GUI.ComboBox_Width.Text <> "" Then
If CDec(GUI.ComboBox_Width.Text) > 0 Then
If CDec(GUI.ComboBox_Width.Text) >= GUI.ComboBox_Width.Items(GUI.ComboBox_Width.Items.Count - 1) AndAlso
CDec(GUI.ComboBox_Width.Text) <= GUI.ComboBox_Width.Items(0) Then
gratingMaxW = CDec(GUI.ComboBox_Width.Text)
GUI_Drawing_Panel.Update_GratingPoints()
End If
End If
'If stocked length options exist
If gratingMaxW = 500 Then
Dim stockedCheckBox As New CheckBox
stockedCheckBox.Name = "CheckBox_Stocked"
stockedCheckBox.Text = "Only stocked lengths"
stockedCheckBox.Left = 94
stockedCheckBox.Top = 386
stockedCheckBox.Checked = True
GUI.Controls.Add(stockedCheckBox)
End If
End Sub
Public Shared Sub LengthChanged(sender As Object, e As EventArgs)
If GUI.ComboBox_Length.Text <> "" Then
If CDec(GUI.ComboBox_Length.Text) > 0 Then
gratingMaxL = CDec(GUI.ComboBox_Length.Text)
If GUI.TextBox_Length.Text <> "" Then
If CDec(GUI.TextBox_Length.Text) >= 200 AndAlso CDec(GUI.TextBox_Length.Text) <= 6000 Then
gratingMaxL = CDec(GUI.TextBox_Length.Text)
GUI_Drawing_Panel.Update_GratingPoints()
Else
'Message: Out of boundary
End If
End If
End Sub
@ -354,7 +381,7 @@
gratingTable.Rows(0)("SERRATED") = False 'Hämta från GUI
gratingTable.Rows(0)("WIDTH") = CDec(GUI.ComboBox_Width.Text)
gratingTable.Rows(0)("LENGTH") = CDec(GUI.ComboBox_Length.Text)
gratingTable.Rows(0)("LENGTH") = CDec(GUI.TextBox_Length.Text)
gratingTable.Rows(0)("LOADBAR_THICKNESS") = CDec(GUI.ComboBox_Thickness.Text)
gratingTable.Rows(0)("LOADBAR_HEIGHT") = CDec(GUI.ComboBox_Height.Text)
gratingTable.Rows(0)("LOADBAR_SPACING") = CDec(lSpacing)
@ -404,23 +431,4 @@
End If
End Sub
End Class