⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmoptions.frm

📁 老外用VB写的CNC仿真程序源码
💻 FRM
📖 第 1 页 / 共 3 页
字号:
    DebugSample.ColWidth(0) = Debuger.C0Width * chkShowLineNumber.Value
End Sub

Private Sub ColorDebugSample()
    DebugSample.Col = 2
    DebugSample.Row = 1
    DebugSample.CellBackColor = TempColors.DebugNormalBackColor
    DebugSample.CellForeColor = TempColors.DebugNormalTextColor
    DebugSample.Col = 1
    DebugSample.CellBackColor = RGB(240, 240, 240)
    DebugSample.Col = 2
    DebugSample.Row = 2
    DebugSample.CellBackColor = TempColors.DebugBreakPointColor
    DebugSample.CellForeColor = TempColors.DebugBreakPointTextColor
    DebugSample.CellFontBold = True
    DebugSample.Col = 1
    DebugSample.CellBackColor = RGB(240, 240, 240)
    DebugSample.Col = 2
    DebugSample.Row = 3
    DebugSample.CellBackColor = TempColors.DebugExecutionPointColor
    DebugSample.ForeColor = TempColors.DebugExecutionPointTextColor
    DebugSample.Col = 1
    DebugSample.CellBackColor = RGB(240, 240, 240)
    
End Sub

Private Sub cmbDebugFonts_Click()
    Dim i%, j%
    For i = 1 To 3
        For j = 0 To 2
            DebugSample.Col = j
            DebugSample.Row = i
            DebugSample.CellFontName = cmbDebugFonts.Text
        Next j
    Next i
    
End Sub

Private Sub cmbDebugFontSize_Click()
    Dim i%, j%
    For i = 1 To 3
        For j = 0 To 2
            DebugSample.Col = j
            DebugSample.Row = i
            DebugSample.CellFontSize = cmbDebugFontSize.Text
            If j = 0 And CInt(cmbDebugFontSize.Text) > 9 Then _
            DebugSample.CellFontSize = CInt(cmbDebugFontSize.Text) - 2
        Next j
    Next i
    
    DebugSample.Refresh
End Sub

Private Sub cmdDebugDefault_Click()
    cmbDebugFonts.Text = "Courier New"
    cmbDebugFontSize.Text = "10"
    chkShowGrid.Value = 1
    chkShowLineNumber.Value = 1
    TempColors.DebugBreakPointColor = RGB(128, 0, 0)
    TempColors.DebugBreakPointTextColor = vbWhite
    TempColors.DebugExecutionPointColor = vbYellow
    TempColors.DebugExecutionPointTextColor = vbBlack
    TempColors.DebugNormalBackColor = vbWhite
    TempColors.DebugNormalTextColor = vbBlack
    cmbDebugColors.ListIndex = 1
    ColorDebugSample
End Sub

Private Sub cmdEditorCancel_Click()
    Unload Me
End Sub

Private Sub cmdEditorDefault_Click()
    cmbEditorFonts.Text = "Courier New"
    cmbEditorFontSize.Text = "10"
    chkEditorFontBold.Value = 0
    TempColors.EditorBackgroundColor = vbWhite
    TempColors.EditorCharacterColor = vbBlue
    TempColors.EditorCommentsColor = RGB(0, 128, 0)
    TempColors.EditorIntegerColor = vbBlack
    chkAutoComplete.Value = 1
    chkAutoReformat.Value = 1
    chkOpenLastFile.Value = 1
    chkSplashScreen.Value = 1
    Coloring
End Sub

Private Sub cmdOK_Click()
    
    SaveSetting "CNC", "TextEditor", "Font", cmbEditorFonts.Text
    SaveSetting "CNC", "TextEditor", "Size", cmbEditorFontSize.Text
    SaveSetting "CNC", "TextEditor", "Integer", TempColors.EditorIntegerColor
    SaveSetting "CNC", "TextEditor", "Character", TempColors.EditorCharacterColor
    SaveSetting "CNC", "TextEditor", "Background", TempColors.EditorBackgroundColor
    SaveSetting "CNC", "TextEditor", "Comment", TempColors.EditorCommentsColor
    SaveSetting "CNC", "TextEditor", "Bold", chkEditorFontBold.Value

    SaveSetting "CNC", "General", "AutoComplete", chkAutoComplete.Value
    SaveSetting "CNC", "General", "SplashScreen", chkSplashScreen.Value
    SaveSetting "CNC", "General", "AutoReformat", chkAutoReformat.Value
    SaveSetting "CNC", "General", "OpenLastFile", chkOpenLastFile.Value

    SaveSetting "CNC", "Debug", "Font", cmbDebugFonts.Text
    SaveSetting "CNC", "Debug", "Size", cmbDebugFontSize.Text
    SaveSetting "CNC", "Debug", "BreakPointColor", TempColors.DebugBreakPointColor
    SaveSetting "CNC", "Debug", "BreakPointTextColor", TempColors.DebugBreakPointTextColor
    SaveSetting "CNC", "Debug", "ExecutionPointColor", TempColors.DebugExecutionPointColor
    SaveSetting "CNC", "Debug", "ExecutionPointTextColor", TempColors.DebugExecutionPointTextColor
    SaveSetting "CNC", "Debug", "NormalBackColor", TempColors.DebugNormalBackColor
    SaveSetting "CNC", "Debug", "NormalTextColor", TempColors.DebugNormalTextColor
    If chkShowLineNumber.Value = 1 Then SaveSetting "CNC", "Debug", "C0Width", DebugSample.ColWidth(0)
    SaveSetting "CNC", "Debug", "C1Width", DebugSample.ColWidth(1)
    SaveSetting "CNC", "Debug", "C2Width", DebugSample.ColWidth(2)
    
    SaveSetting "CNC", "Debug", "Grid", chkShowGrid.Value
    SaveSetting "CNC", "Debug", "LineNumbers", chkShowLineNumber.Value
    
    Dim i As Integer
    i = DebugSample.RowHeight(1)
    If DebugSample.RowHeight(2) > DebugSample.RowHeight(1) Then _
        i = DebugSample.RowHeight(2)
    If DebugSample.RowHeight(3) > DebugSample.RowHeight(2) And DebugSample.RowHeight(3) > DebugSample.RowHeight(1) Then _
        i = DebugSample.RowHeight(3)
    SaveSetting "CNC", "Debug", "RowHeight", i
    
    SaveSetting "CNC", "SimulationWindow", "WorkPieceColor", lblWPColor.BackColor
    SaveSetting "CNC", "SimulationWindow", "BackColor", lblBackColor.BackColor
    SaveSetting "CNC", "SimulationWindow", "EffectColor", lblEffectColor.BackColor
    
    Call InitializeTypeVariables
    frmMain.Tag = "OK"
    Unload Me
    DoEvents
End Sub


Private Sub cmdSimDefaults_Click()
    TempColors.wpBackColor = vbWhite
    TempColors.WPColor = vbBlue
    lblWPColor.BackColor = vbBlue
    lblBackColor.BackColor = vbWhite
    lblEffectColor.BackColor = RGB(150, 150, 255)
    DrawWorkPiece
End Sub


Private Sub DebugSample_DblClick()
    DebugSample.RowHeight(1) = DebugSample.RowHeight(DebugSample.MouseRow)
    DebugSample.RowHeight(2) = DebugSample.RowHeight(DebugSample.MouseRow)
    DebugSample.RowHeight(3) = DebugSample.RowHeight(DebugSample.MouseRow)
End Sub

Private Sub Form_Resize()
    
    Call TempColorSettings
    DoEvents
    Call ImplementTypeVariables
    cmbEditorColours.ListIndex = 0
    cmbDebugColors.ListIndex = 0
End Sub


Private Sub ImplementTypeVariables()
    
    Dim i As Integer
    SSTab.Tab = 0
    cmbEditorFonts.Text = Editor.FontName
    cmbDebugFonts.Text = Debuger.FontName
    For i = 8 To 24
        cmbEditorFontSize.AddItem i
        cmbDebugFontSize.AddItem i
    Next i
    
    cmbEditorFontSize.Text = Editor.FontSize
    cmbDebugFontSize.Text = Debuger.FontSize
       
    chkEditorFontBold.Value = Editor.Bold
    
    richSample.Text = "[BILLET X20 Z40" & vbCrLf & "G00 X20 Z0" & vbCrLf & "G01 Z-40"
    richSample.SelStart = 0
    richSample.SelLength = Len(richSample.Text)
    richSample.SelFontName = cmbEditorFonts.Text
    richSample.SelFontSize = cmbEditorFontSize.Text
    richSample.SelBold = chkEditorFontBold.Value
    richSample.SelStart = 0
    richSample.SelLength = 0
    Call Coloring
    
    DebugSample.TextMatrix(1, 0) = "001"
    DebugSample.TextMatrix(2, 0) = "002"
    DebugSample.TextMatrix(3, 0) = "003"
    DebugSample.TextMatrix(1, 2) = "[BILLET X20 Z40"
    DebugSample.TextMatrix(2, 2) = "G00 X20 Z00"
    DebugSample.TextMatrix(3, 2) = "G01 X20 Z-20"
    
    DebugSample.ColWidth(0) = Debuger.C0Width * chkShowLineNumber.Value
    DebugSample.ColWidth(1) = Debuger.C1Width
    DebugSample.ColWidth(2) = Debuger.C2Width
    DebugSample.RowHeight(0) = 75
    DebugSample.RowHeight(1) = Debuger.RowHeight
    DebugSample.RowHeight(2) = Debuger.RowHeight
    DebugSample.RowHeight(3) = Debuger.RowHeight
    DebugSample.Col = 1
    DebugSample.Row = 2
    Set DebugSample.CellPicture = imglstDebug.ListImages("Break").Picture
    DebugSample.Row = 3
    Set DebugSample.CellPicture = imglstDebug.ListImages("Step").Picture
    
    chkShowLineNumber.Value = Debuger.LineNumbers
    chkShowGrid.Value = Debuger.Grid
    chkAutoComplete.Value = GeneralSettings.AutoComplete
    chkAutoReformat.Value = GeneralSettings.AutoReformat
    chkOpenLastFile.Value = GeneralSettings.OpenLastFile
    chkSplashScreen.Value = GeneralSettings.SplashScreen
    
    lblWPColor.BackColor = SimWindow.WPColor
    lblBackColor.BackColor = SimWindow.BackColor
    lblEffectColor.BackColor = SimWindow.EffectColor
End Sub


Private Sub cmbDebugColors_click()
    Select Case cmbDebugColors.List(cmbDebugColors.ListIndex)
        Case "Break Point Back Colour":
            lblDebugColor.BackColor = TempColors.DebugBreakPointColor
        Case "Execution Point Colour":
            lblDebugColor.BackColor = TempColors.DebugExecutionPointColor
        Case "Normal Back Colour":
            lblDebugColor.BackColor = TempColors.DebugNormalBackColor
        Case "Break Point Text Colour":
            lblDebugColor.BackColor = TempColors.DebugBreakPointTextColor
        Case "Execution Point Text Color":
            lblDebugColor.BackColor = TempColors.DebugExecutionPointTextColor
        Case "Normal Text Colour":
            lblDebugColor.BackColor = TempColors.DebugNormalTextColor
    End Select
End Sub


Private Sub Coloring()
    richSample.BackColor = TempColors.EditorBackgroundColor
    
    richSample.SelStart = 0
    richSample.SelLength = 15
    richSample.SelColor = TempColors.EditorCommentsColor
    
    richSample.SelStart = 17
    richSample.SelLength = 1
    richSample.SelColor = TempColors.EditorCharacterColor
    
    richSample.SelStart = 21
    richSample.SelLength = 1
    richSample.SelColor = TempColors.EditorCharacterColor
    
    richSample.SelStart = 25
    richSample.SelLength = 1
    richSample.SelColor = TempColors.EditorCharacterColor
    
    richSample.SelStart = 33
    richSample.SelLength = 1
    richSample.SelColor = TempColors.EditorCharacterColor
    
    richSample.SelStart = 18
    richSample.SelLength = 2
    richSample.SelColor = TempColors.EditorIntegerColor
    
    richSample.SelStart = 22
    richSample.SelLength = 2
    richSample.SelColor = TempColors.EditorIntegerColor
    
    richSample.SelStart = 26
    richSample.SelLength = 1
    richSample.SelColor = TempColors.EditorIntegerColor
    
    richSample.SelStart = 34
    richSample.SelLength = 2
    richSample.SelColor = TempColors.EditorIntegerColor
        
End Sub

Private Sub chkEditorFontBold_Click()
    richSample.SelStart = 0
    richSample.SelLength = Len(richSample.Text)
    richSample.SelBold = chkEditorFontBold.Value
    richSample.SelStart = 0
    richSample.SelLength = 0
    DoEvents
End Sub

Private Sub cmbEditorColours_Click()
        Select Case cmbEditorColours.List(cmbEditorColours.ListIndex)
            Case "Characters":
                lblEditorColor.BackColor = TempColors.EditorCharacterColor
            Case "Integers":
                lblEditorColor.BackColor = TempColors.EditorIntegerColor
            Case "Comments":
                lblEditorColor.BackColor = TempColors.EditorCommentsColor
            Case "Background":
                lblEditorColor.BackColor = TempColors.EditorBackgroundColor
        End Select
End Sub

Private Sub cmbEditorFonts_Click()
    richSample.SelStart = 0
    richSample.SelLength = Len(richSample.Text)
    richSample.SelFontName = cmbEditorFonts.Text
    richSample.SelStart = 0
    richSample.SelLength = 0
    DoEvents
End Sub

Private Sub cmbEditorFontSize_Click()
    richSample.SelStart = 0
    richSample.SelLength = Len(richSample.Text)
    richSample.SelFontSize = cmbEditorFontSize.Text
    richSample.SelStart = 0
    richSample.SelLength = 0
    DoEvents
End Sub

Private Sub lblBackColor_Click()
    frmMain.com.ShowColor
    lblBackColor.BackColor = frmMain.com.color
    DoEvents
    DrawWorkPiece
End Sub

Private Sub lblDebugColor_Click()
    frmMain.com.ShowColor
    lblDebugColor.BackColor = frmMain.com.color
    Select Case cmbDebugColors.Text
        Case "Break Point Back Colour":
            TempColors.DebugBreakPointColor = lblDebugColor.BackColor
        Case "Execution Point Colour":
            TempColors.DebugExecutionPointColor = lblDebugColor.BackColor
        Case "Normal Back Colour":
            TempColors.DebugNormalBackColor = lblDebugColor.BackColor
        Case "Break Point Text Colour":
            TempColors.DebugBreakPointTextColor = lblDebugColor.BackColor
        Case "Execution Point Text Color":
            TempColors.DebugExecutionPointTextColor = lblDebugColor.BackColor
        Case "Normal Text Colour":
            TempColors.DebugNormalTextColor = lblDebugColor.BackColor
    End Select
    Call ColorDebugSample
End Sub

Private Sub lblEditorColor_Click()
    frmMain.com.ShowColor
    lblEditorColor.BackColor = frmMain.com.color
    Select Case cmbEditorColours.Text
        Case "Characters":
            TempColors.EditorCharacterColor = lblEditorColor.BackColor
        Case "Integers":
            TempColors.EditorIntegerColor = lblEditorColor.BackColor
        Case "Comments":
            TempColors.EditorCommentsColor = lblEditorColor.BackColor
        Case "Background":
            TempColors.EditorBackgroundColor = lblEditorColor.BackColor
    End Select
    Call Coloring
End Sub

Private Sub lblEffectColor_Click()
    frmMain.com.ShowColor
    lblEffectColor.BackColor = frmMain.com.color
    DoEvents
    DrawWorkPiece
End Sub

Private Sub lblWPColor_Click()
    frmMain.com.ShowColor
    lblWPColor.BackColor = frmMain.com.color
    DoEvents
    DrawWorkPiece
End Sub

Private Sub SSTab_Click(PreviousTab As Integer)
    Select Case SSTab.Tab
        Case 0:
        
        Case 1:
                Call ColorDebugSample
            
        Case 2:
            DoEvents
            DrawWorkPiece
    End Select
End Sub


Private Sub DrawWorkPiece()
            picSample.BackColor = lblBackColor.BackColor
            picSample.Line (0, picSample.ScaleHeight / 2 - 30)-(60, picSample.ScaleHeight / 2 + 30), lblWPColor.BackColor, BF
            picSample.Line (60, picSample.ScaleHeight / 2 - 20)-(120, picSample.ScaleHeight / 2 + 20), lblWPColor.BackColor, BF
            picSample.DrawWidth = 1
            picSample.Line (60, picSample.ScaleHeight / 2 - 30)-(60, picSample.ScaleHeight / 2 + 30), lblEffectColor.BackColor, BF
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -