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

📄 form6.frm

📁 GPS卫星定位系统相关源代码
💻 FRM
📖 第 1 页 / 共 4 页
字号:
      Begin VB.Image Image1 
         Height          =   480
         Left            =   165
         Picture         =   "Form6.frx":2946
         ToolTipText     =   "设置系统路径"
         Top             =   240
         Width           =   480
      End
   End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Port(1 To 8) As Integer
Private Baud(1 To 8), parity(1 To 8), DataBit(1 To 8), StopBit(1 To 8) As String
Private Which As Integer
Private m_bOk As Boolean

Private Sub Check1_Click()
If Check1.Value = 1 Then
   Label4.Enabled = True
   Text4.Enabled = True
   Label10.Enabled = True
   Text8.Enabled = True
   Temp_Lock_Flag = True
Else
   Label10.Enabled = False
   Text8.Enabled = False
   Label4.Enabled = False
   Text4.Enabled = False
   Temp_Lock_Flag = False
End If
End Sub

Private Sub Check2_Click()
If Check2.Value = 1 Then
   Label7.Enabled = True
   Text5.Enabled = True
Else
   Label7.Enabled = False
   Text5.Enabled = False
End If
End Sub

Private Sub Command1_Click()
Frame2.Visible = False
Frame2.Move 7560, -90
Frame7.Visible = False
Frame7.Move 7560, -90
Frame1.Visible = True
Frame1.Move 960, -90
setPath
End Sub

Private Sub Command10_Click()
Unload Me
End Sub

Private Sub Command5_Click()
If Trim(Text1.Text) <> "" Then
   Ini_SavePath Trim(Text1.Text)
End If
If Trim(Text2.Text) <> "" Then
   Ini_SaveDefaultSpaDBFileName Trim(Text2.Text)
End If
If Trim(Text3.Text) <> "" Then
   Ini_SaveDefaultCMPName Trim(Text3.Text)
End If
If IsNumeric(Trim(Text4.Text)) And Val(Text4.Text) < 200 Then
   Ini_Lock_Save Trim(Text4.Text)
End If
If Trim(Text5.Text) <> "" Then
   Ini_IP_Save Trim(Text5.Text)
End If
If IsNumeric(Trim(Text8.Text)) And Val(Text8.Text) < 20 Then
   Ini_Road_Save Trim(Text8.Text)
End If
If Check1.Value = 1 Then
   Temp_Lock_Flag = True
   Ini_LockFlag_Save
End If
End Sub

Private Sub Command6_Click()
Unload Me
End Sub

Private Sub Command7_Click()
Frame1.Visible = False
Frame1.Move 7560, -90
Frame7.Visible = False
Frame7.Move 7560, -90
Frame2.Visible = True
Frame2.Move 960, -90
setCOM
End Sub

Private Sub Command8_Click()
Frame2.Visible = False
Frame2.Move 7560, -90
Frame1.Visible = False
Frame1.Move 7560, -90
Frame7.Visible = True
Frame7.Move 960, -90
End Sub

Private Sub Command9_Click()
    Temp_Back
End Sub

Private Sub Form_Load()
    Label5.Caption = "确实要还原缺省值!"
    m_bOk = False
    Which = 1
    OptionFunc(1).Value = True
    Command1_Click
    If Temp_Lock_Flag = True Then Check1.Value = 1
End Sub

Private Sub Form_Unload(Cancel As Integer)
Form6.WindowState = 1
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Visible = True
Command7.Visible = False
Command8.Visible = False
End Sub

Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command7.Visible = True
Command1.Visible = False
Command8.Visible = False
End Sub

Private Sub Image3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command8.Visible = True
Command1.Visible = False
Command7.Visible = False
End Sub

Public Function IsOk() As Boolean
    IsOk = m_bOk
End Function

Public Sub SendCommSetting(ByVal i As Integer, ByVal iPort As Integer, ByVal sBaud As String, ByVal sParity As String, ByVal sDataBit As String, ByVal sStopBit As String)
    Port(i) = iPort
    parity(i) = sParity
    Baud(i) = sBaud
    DataBit(i) = sDataBit
    StopBit(i) = sStopBit
End Sub

Private Sub cmdCancle_Click()
    Unload Me
End Sub

Private Sub cmdOk_Click()
    If Port(1) = Port(2) And Port(2) = Port(3) And Port(3) = Port(4) Then
        MsgBox "Gps和110串口不可以相同"
        Exit Sub
    End If
    Ini_SaveCommSetting "comm1", Port(1), Baud(1), parity(1), DataBit(1), StopBit(1)
    Ini_SaveCommSetting "comm2", Port(2), Baud(2), parity(2), DataBit(2), StopBit(2)
    Ini_SaveCommSetting "comm3", Port(3), Baud(3), parity(3), DataBit(3), StopBit(3)
    Ini_SaveCommSetting "comm4", Port(4), Baud(4), parity(4), DataBit(4), StopBit(4)
    Ini_SaveCommSetting "comm5", Port(5), Baud(5), parity(5), DataBit(5), StopBit(5)
    Ini_SaveCommSetting "comm6", Port(6), Baud(6), parity(6), DataBit(6), StopBit(6)
    Ini_SaveCommSetting "comm7", Port(7), Baud(7), parity(7), DataBit(7), StopBit(7)
    Ini_SaveCommSetting "comm8", Port(8), Baud(8), parity(8), DataBit(8), StopBit(8)
    m_bOk = True
    Unload Me
End Sub


Private Sub OptionFunc_Click(Index As Integer)
    Which = Index
    SetCommSetting Port(Index), Baud(Index), parity(Index), DataBit(Index), StopBit(Index)
End Sub

Private Sub SetCommSetting(ByVal Port As Integer, _
ByVal Baud As String, ByVal parity As String, _
ByVal DataBit As String, ByVal StopBit As String)
    Select Case Port
        Case 1
            cmbPort.ListIndex = 0
        Case 2
            cmbPort.ListIndex = 1
        Case 3
            cmbPort.ListIndex = 2
        Case 4
            cmbPort.ListIndex = 3
        Case 5
            cmbPort.ListIndex = 4
        Case 6
            cmbPort.ListIndex = 5
        Case 7
            cmbPort.ListIndex = 6
        Case 8
            cmbPort.ListIndex = 7
    End Select
    Select Case Baud
        Case "2400"
            OptionBaud(0).Value = True
        Case "4800"
            OptionBaud(1).Value = True
        Case "9600"
            OptionBaud(2).Value = True
        Case "19200"
            OptionBaud(3).Value = True
    End Select
    Select Case parity
        Case "N"
            OptionParity(0).Value = True
        Case "O"
            OptionParity(1).Value = True
        Case "E"
            OptionParity(2).Value = True
    End Select
    Select Case DataBit
        Case "5"
            OptionDataBits(0).Value = True
        Case "6"
            OptionDataBits(1).Value = True
        Case "7"
            OptionDataBits(2).Value = True
        Case "8"
            OptionDataBits(3).Value = True
    End Select
    Select Case StopBit
        Case "1"
            OptionStopBits(0).Value = True
        Case "1.5"
            OptionStopBits(1).Value = True
        Case "2"
            OptionStopBits(2).Value = True
    End Select
End Sub

Private Sub cmbPort_Click()
    Port(Which) = cmbPort.ItemData(cmbPort.ListIndex)
End Sub

Private Sub OptionBaud_Click(Index As Integer)
    If OptionBaud(0).Value Then
        Baud(Which) = "2400"
    End If
    If OptionBaud(1).Value Then
        Baud(Which) = "4800"
    End If
    If OptionBaud(2).Value Then
        Baud(Which) = "9600"
    End If
    If OptionBaud(3).Value Then
        Baud(Which) = "19200"
    End If
End Sub

Private Sub OptionParity_Click(Index As Integer)
    If OptionParity(0).Value Then
        parity(Which) = "N"
    End If
    If OptionParity(1).Value Then
         parity(Which) = "O"
    End If
    If OptionParity(2).Value Then
         parity(Which) = "E"
    End If
End Sub

Private Sub OptionDataBits_Click(Index As Integer)
     If OptionDataBits(0).Value Then
         DataBit(Which) = "5"
    End If
    If OptionDataBits(1).Value Then
         DataBit(Which) = "6"
    End If
    If OptionDataBits(2).Value Then
         DataBit(Which) = "7"
    End If
    If OptionDataBits(3).Value Then
         DataBit(Which) = "8"
    End If
End Sub

Private Sub OptionStopBits_Click(Index As Integer)
    If OptionStopBits(0).Value Then
         StopBit(Which) = "1"
    End If
    If OptionStopBits(1).Value Then
         StopBit(Which) = "1.5"
    End If
    If OptionStopBits(2).Value Then
         StopBit(Which) = "2"
    End If
End Sub


Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X < 360 Or X > 840 Or Y < 160 Or Y > 640 Then
   Command1.Visible = False
End If
If X < 1440 Or X > 1920 Or Y < 160 Or Y > 640 Then
   Command7.Visible = False
End If
If X < 2520 Or X > 3000 Or Y < 160 Or Y > 640 Then
   Command8.Visible = False
End If
End Sub

Private Sub setCOM()
    Dim comPort As Integer
    Dim comBaud As String
    Dim comparity As String
    Dim comDataBit As String
    Dim comStopBit As String
    Ini_GetCommSetting "comm1", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 1, comPort, comBaud, comparity, comDataBit, comStopBit
    
    Ini_GetCommSetting "comm2", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 2, comPort, comBaud, comparity, comDataBit, comStopBit
    
    Ini_GetCommSetting "comm3", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 3, comPort, comBaud, comparity, comDataBit, comStopBit
    
    Ini_GetCommSetting "comm4", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 4, comPort, comBaud, comparity, comDataBit, comStopBit
    
    Ini_GetCommSetting "comm5", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 5, comPort, comBaud, comparity, comDataBit, comStopBit
    
    Ini_GetCommSetting "comm6", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 6, comPort, comBaud, comparity, comDataBit, comStopBit
    
    Ini_GetCommSetting "comm7", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 7, comPort, comBaud, comparity, comDataBit, comStopBit
    
    Ini_GetCommSetting "comm8", comPort, comBaud, comparity, comDataBit, comStopBit
    SendCommSetting 8, comPort, comBaud, comparity, comDataBit, comStopBit
    
    SetCommSetting Port(1), Baud(1), parity(1), DataBit(1), StopBit(1)
End Sub

Private Sub setPath()
Text1.Text = Ini_GetPath
Text2.Text = Ini_GetDefaultSpaDBFileName
Text3.Text = Ini_GetDefaultCMPName
Text4.Text = Ini_Lock
Text5.Text = Ini_IP
Text8.Text = Ini_Road
End Sub

⌨️ 快捷键说明

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