Imports XCCLibrary Public Class GUI Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb" 'Public Shared filepath As String = "C:\Users\xperd\Documents" ' --- Start method (main) for GUI --- Sub GUI_load() Handles MyBase.Load ' Initialize GUI Init_Form() ' Initialize DataTables, Measurments and more Data.Init_Data() ' Initialize DrawingPanel Draw_Grating.Load_DrawingPanel() ' Get floor gratings database Database.Retrive_Database() ' Load XCC settings adminClass.loadSettings(Settings.filesFolder, Settings.HLCtFolder, "SolidWorks") End Sub ' --- Initialize GUI (form) size and position --- Private Sub Init_Form() Me.Width = 1400 Me.Height = 800 Me.Top = 20 Me.Left = 50 End Sub ' ---------------------------------- GUI Templates ---------------------------------- ' --- TextBox Template --- Public Sub Create_TextBox(TextBoxName As String, TextBoxText As String, TextBoxLeft As Integer, TextBoxTop As Integer, TextBoxWidth As Integer) Dim textBoxTemp As New TextBox With { .Name = TextBoxName, .Text = TextBoxText, .Left = TextBoxLeft, .Top = TextBoxTop, .Width = TextBoxWidth, .Font = New Font("Microsoft Sans Serif", 10) } Me.Controls.Add(textBoxTemp) End Sub ' --- Label Template for GUI --- Public Sub Create_LabelGUI(LabelName As String, LabelText As String, LabelLeft As Integer, LabelTop As Integer) Dim LabelTemp As New Label With { .Name = LabelName, .Text = LabelText, .Left = LabelLeft, .Top = LabelTop, .Font = New Font("Microsoft Sans Serif", 10) } Me.Controls.Add(LabelTemp) End Sub ' ---------------------------------- Gratings Data ---------------------------------- ' --- When user changes grating type --- Private Sub ComboBox_TypeChooser_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_TypeChooser.TextChanged User_Input.TypeChanged(sender, e) End Sub ' --- When user changes grating material --- Private Sub ComboBox_Material_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Material.TextChanged User_Input.MaterialChanged(sender, e) End Sub ' --- When user changes mesh size --- Private Sub ComboBox_MeshSize_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_MeshSize.TextChanged User_Input.MeshChanged(sender, e) End Sub ' --- When user changes grating height --- Private Sub ComboBox_Height_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Height.TextChanged User_Input.HeightChanged(sender, e) End Sub ' --- When user changes grating thickness --- Private Sub ComboBox_Thickness_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Thickness.TextChanged User_Input.ThicknessChanged(sender, e) End Sub ' --- When user checkes/uncheckes whole meshes --- Private Sub CheckBox_WholeMeshWidths_CheckedChanged(sender As Object, e As EventArgs) _ Handles CheckBox_WholeMeshWidths.CheckedChanged User_Input.WholeMeshWidthsChanged(sender, e) End Sub ' --- Grating width changed --- Private Sub WidthB_TextChanged(sender As Object, e As EventArgs) Handles ComboBox_Width.TextChanged User_Input.WidthChanged(sender, e) End Sub ' --- Check if width is a number --- Private Sub ComboBox_Width_KeyPress(sender As Object, e As KeyPressEventArgs) Handles ComboBox_Width.KeyPress User_Input.Check_IfNumber(e) End Sub ' --- Grating length changed --- Private Sub LengthBox_TextChanged(sender As Object, e As EventArgs) Handles TextBox_Length.TextChanged User_Input.LengthChanged(sender, e) End Sub ' --- Check if length is a number --- Private Sub ComboBox_Length_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox_Length.KeyPress User_Input.Check_IfNumber(e) End Sub ' ---------------------------------- Functions ---------------------------------- ' --- When angle button is pressed --- Private Sub AngleButton_Click(sender As Object, e As EventArgs) Handles AngleButton.Click Corner_Angle.AngleButton(sender, e) End Sub ' --- When square corner button is pressed --- Private Sub Button_Square_Click(sender As Object, e As EventArgs) Handles Button_Square.Click Corner_Rectangle.SquareButtton(sender, e) End Sub ' --- When square side button is pressed --- Private Sub Button_SquareSide_Click(sender As Object, e As EventArgs) Handles Button_SquareSide.Click Side_Rectangle.SquareSideButtton(sender, e) End Sub ' ---------------------------------- Settings ---------------------------------- ' --- Settings button clicked --- Private Sub SettingsButton_Click(sender As Object, e As EventArgs) Handles SettingsButton.Click Settings.ButtonClicked(sender, e) End Sub ' ---------------------------------- Export to SW ---------------------------------- ' --- When export to SW button is pressed --- Private Sub ExportSWButton_Click(sender As Object, e As EventArgs) Handles ExportSWButton.Click Model_3D.BuildGrating() Drawing.CreateDrawing() End Sub End Class