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

📄 globalvariables.bas

📁 老外用VB写的CNC仿真程序源码
💻 BAS
字号:
Attribute VB_Name = "GlobalVariables"
Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public TAPER As Integer
Public ThreeDArray() As Integer
Public RunToCursor As Boolean
Public ToolListArray(20) As String

'Public FromCo As Coordinates, ToCo As Coordinates

Private Type EditorDataType
    FontName As String
    FontSize As Integer
    CharacterColor As Long
    IntegerColor As Long
    CommentsColor As Long
    BackgroundColor As Long
    Bold As Integer
End Type
Public Editor As EditorDataType

Private Type SimulationType
    WPColor As Long
    BackColor As Long
    EffectColor As Long
End Type

Public SimWindow As SimulationType

Private Type GeneralDataType
    AutoComplete As Integer
    AutoReformat As Integer
    OpenLastFile As Integer
    SplashScreen As Integer
End Type
Public GeneralSettings As GeneralDataType

Private Type DebugDataType
    FontName As String
    FontSize As Integer
    BreakPointColor As Long
    BreakPointTextColor As Long
    ExecutionColor As Long
    ExecutionTextColor As Long
    NormalTextColor As Long
    NormalBackColor As Long
    C0Width As Integer
    C1Width As Integer
    C2Width As Integer
    RowHeight As Integer
    Grid As Integer
    LineNumbers As Integer
    
End Type
Public Debuger As DebugDataType

Public PicWidth As Integer, PicHeight As Integer
Public WorkPieceLength As Integer, WorkPieceDiameter As Integer
Public CurrentLineNumber As Integer
Public StopSimulation As Boolean

Public Sub SetFirstTimeSettings()

    SaveSetting "CNC", "TextEditor", "Font", "Courier New"
    SaveSetting "CNC", "TextEditor", "Size", "10"
    SaveSetting "CNC", "TextEditor", "Integer", vbBlack
    SaveSetting "CNC", "TextEditor", "Character", vbBlue
    SaveSetting "CNC", "TextEditor", "Background", vbWhite
    SaveSetting "CNC", "TextEditor", "Comment", RGB(0, 128, 0)
    SaveSetting "CNC", "TextEditor", "Bold", "0"
    
    SaveSetting "CNC", "General", "AutoComplete", "1"
    SaveSetting "CNC", "General", "SplashScreen", "1"
    SaveSetting "CNC", "General", "AutoReformat", "1"
    SaveSetting "CNC", "General", "OpenLastFile", "1"
    
    SaveSetting "CNC", "Debug", "Font", "Courier New"
    SaveSetting "CNC", "Debug", "Size", "10"
    SaveSetting "CNC", "Debug", "BreakPointColor", RGB(128, 0, 0)
    SaveSetting "CNC", "Debug", "BreakPointTextColor", vbWhite
    SaveSetting "CNC", "Debug", "ExecutionPointColor", vbYellow
    SaveSetting "CNC", "Debug", "ExecutionPointTextColor", vbBlack
    SaveSetting "CNC", "Debug", "NormalBackColor", vbWhite
    SaveSetting "CNC", "Debug", "NormalTextColor", vbBlack
    SaveSetting "CNC", "Debug", "C0Width", "350"
    SaveSetting "CNC", "Debug", "C1Width", "300"
    SaveSetting "CNC", "Debug", "C2Width", "3500"
    SaveSetting "CNC", "Debug", "RowHeight", "285"
    SaveSetting "CNC", "Debug", "Grid", "1"
    SaveSetting "CNC", "Debug", "LineNumbers", "1"
    
    
    SaveSetting "CNC", "SimulationWindow", "WorkPieceColor", vbBlue
    SaveSetting "CNC", "SimulationWindow", "BackColor", vbWhite
    SaveSetting "CNC", "SimulationWindow", "EffectColor", RGB(150, 150, 255)
End Sub

Public Sub InitializeTypeVariables()
If GetSetting("CNC", "TextEditor", "Font") = "" Then Call SetFirstTimeSettings
    Editor.FontName = GetSetting("CNC", "TextEditor", "Font")
    Editor.FontSize = GetSetting("CNC", "TextEditor", "Size")
    Editor.CharacterColor = GetSetting("CNC", "TextEditor", "Character")
    Editor.CommentsColor = GetSetting("CNC", "TextEditor", "Comment")
    Editor.IntegerColor = GetSetting("CNC", "TextEditor", "Integer")
    Editor.BackgroundColor = GetSetting("CNC", "TextEditor", "Background")
    Editor.Bold = GetSetting("CNC", "TextEditor", "Bold")
       
    Debuger.BreakPointColor = GetSetting("CNC", "Debug", "BreakPointColor")
    Debuger.BreakPointTextColor = GetSetting("CNC", "Debug", "BreakPointTextColor")
    Debuger.ExecutionColor = GetSetting("CNC", "Debug", "ExecutionPointColor")
    Debuger.ExecutionTextColor = GetSetting("CNC", "Debug", "ExecutionPointTextColor")
    Debuger.NormalTextColor = GetSetting("CNC", "Debug", "NormalTextColor")
    Debuger.NormalBackColor = GetSetting("CNC", "Debug", "NormalBackColor")
    
    Debuger.FontName = GetSetting("CNC", "Debug", "Font")
    Debuger.FontSize = GetSetting("CNC", "Debug", "Size")
    Debuger.C0Width = GetSetting("CNC", "Debug", "C0Width")
    Debuger.C1Width = GetSetting("CNC", "Debug", "C1Width")
    Debuger.C2Width = GetSetting("CNC", "Debug", "C2Width")
    Debuger.RowHeight = GetSetting("CNC", "Debug", "RowHeight")
    Debuger.Grid = GetSetting("CNC", "Debug", "Grid")
    Debuger.LineNumbers = GetSetting("CNC", "Debug", "LineNumbers")
    
       
    SimWindow.WPColor = GetSetting("CNC", "SimulationWindow", "WorkPieceColor")
    SimWindow.BackColor = GetSetting("CNC", "SimulationWindow", "BackColor")
    SimWindow.EffectColor = GetSetting("CNC", "SimulationWindow", "EffectColor")
    
    GeneralSettings.AutoComplete = GetSetting("CNC", "General", "AutoComplete")
    GeneralSettings.AutoReformat = GetSetting("CNC", "General", "AutoReformat")
    GeneralSettings.OpenLastFile = GetSetting("CNC", "General", "OpenLastFile")
    GeneralSettings.SplashScreen = GetSetting("CNC", "General", "SplashScreen")
    
End Sub

⌨️ 快捷键说明

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