?? form1.frm
字號:
Top = 360
Width = 1575
End
Begin VB.Label lbl62
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2640
TabIndex = 10
Top = 2880
Width = 1575
End
Begin VB.Label lbl52
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2640
TabIndex = 9
Top = 2040
Width = 1575
End
Begin VB.Label lbl42
BackColor = &H00C0FFC0&
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2640
TabIndex = 8
Top = 1200
Width = 1575
End
Begin VB.Shape shape22
BackStyle = 1 'Opaque
FillColor = &H000000FF&
Height = 615
Left = 3120
Shape = 3 'Circle
Top = 5400
Width = 735
End
Begin VB.Shape shape11
BackStyle = 1 'Opaque
FillColor = &H000000FF&
Height = 615
Left = 3120
Shape = 3 'Circle
Top = 4560
Width = 735
End
Begin VB.Label Label11
BackColor = &H00FFFFC0&
Caption = "Over Temperature"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 120
TabIndex = 7
Top = 4560
Width = 2415
End
Begin VB.Label Label10
BackColor = &H00FFFFC0&
Caption = "Over Speed"
BeginProperty Font
Name = "Times New Roman"
Size = 14.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 120
TabIndex = 6
Top = 5400
Width = 2415
End
End
Begin MSCommLib.MSComm MSComm1
Left = 360
Top = 8400
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
RThreshold = 15
End
Begin VB.Frame Frame3
BackColor = &H00808080&
Height = 1215
Left = 240
TabIndex = 1
Top = 9720
Width = 13815
Begin VB.CommandButton Command3
BackColor = &H008080FF&
Caption = "Exit"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 10680
Style = 1 'Graphical
TabIndex = 4
Top = 360
Width = 2055
End
Begin VB.CommandButton Command2
BackColor = &H008080FF&
Caption = "About Project"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 6120
Style = 1 'Graphical
TabIndex = 3
Top = 360
Width = 2055
End
Begin VB.CommandButton Command1
BackColor = &H008080FF&
Caption = "About Us"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 1440
Style = 1 'Graphical
TabIndex = 2
Top = 360
Width = 2055
End
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H00000000&
Caption = " CONTROL AREA NETWORK MONITORING SYSTEM"
BeginProperty DataFormat
Type = 1
Format = "M/d/yyyy"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1033
SubFormatType = 3
EndProperty
BeginProperty Font
Name = "Times New Roman"
Size = 24
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 1080
Left = 1785
TabIndex = 0
Top = 120
Width = 10485
WordWrap = -1 'True
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sender As String
Private Sub Command1_Click()
Form2.Show
End Sub
Private Sub Command2_Click()
Form3.Show
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
'MsgBox Cbin(88)
MSComm1.Output = "D" & Chr(Text1.Text)
End Sub
Private Sub Form_Load()
Sender = "C"
Me.MSComm1.PortOpen = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
Me.MSComm1.PortOpen = False
End Sub
Private Sub MSComm1_OnComm()
'On Error GoTo K
Dim data As String
If Me.MSComm1.CommEvent = 2 Then
data = Me.MSComm1.Input
' MsgBox Len(data) & " ==== " & data
'MsgBox data
Select Case Sender
' Case "A"
' lbl1.Caption = Asc(Mid(data, 2, 1))
' lbl2.Caption = Asc(Mid(data, 5, 1)) & Asc(Mid(data, 4, 1)) & Asc(Mid(data, 3, 1))
' Case "B"
' lbl3.Caption = Asc(Mid(data, 2, 1))
' lbl4.Caption = Asc(Mid(data, 5, 1)) & Asc(Mid(data, 4, 1)) & Asc(Mid(data, 3, 1))
' f = Cbin(Asc(Mid(data, 6, 1)))
' MsgBox f
' ShowLed (f)
Case "A"
lbl31.Caption = (Mid(data, 1, 1)) & (Mid(data, 2, 1)) & (Mid(data, 3, 1))
lbl41.Caption = (Mid(data, 4, 1)) & (Mid(data, 5, 1)) & (Mid(data, 6, 1)) & (Mid(data, 7, 1))
lbl51.Caption = (Mid(data, 8, 1)) & (Mid(data, 9, 1)) & (Mid(data, 10, 1))
lbl61.Caption = (Mid(data, 11, 1)) & (Mid(data, 12, 1)) & (Mid(data, 13, 1)) & (Mid(data, 14, 1))
f = Cbin(Asc(Mid(data, 15, 1)))
' MsgBox f
ShowLed CStr(f), 1
Case "B"
lbl32.Caption = (Mid(data, 1, 1)) & (Mid(data, 2, 1)) & (Mid(data, 3, 1))
lbl42.Caption = (Mid(data, 4, 1)) & (Mid(data, 5, 1)) & (Mid(data, 6, 1)) & (Mid(data, 7, 1))
lbl52.Caption = (Mid(data, 8, 1)) & (Mid(data, 9, 1)) & (Mid(data, 10, 1))
lbl62.Caption = (Mid(data, 11, 1)) & (Mid(data, 12, 1)) & (Mid(data, 13, 1)) & (Mid(data, 14, 1))
f = Cbin(Asc(Mid(data, 15, 1)))
' MsgBox f
ShowLed CStr(f), 2
Case "C"
lbl33.Caption = (Mid(data, 1, 1)) & (Mid(data, 2, 1)) & (Mid(data, 3, 1))
lbl43.Caption = (Mid(data, 4, 1)) & (Mid(data, 5, 1)) & (Mid(data, 6, 1)) & (Mid(data, 7, 1))
lbl53.Caption = (Mid(data, 8, 1)) & (Mid(data, 9, 1)) & (Mid(data, 10, 1))
lbl63.Caption = (Mid(data, 11, 1)) & (Mid(data, 12, 1)) & (Mid(data, 13, 1)) & (Mid(data, 14, 1))
f = Cbin(Asc(Mid(data, 15, 1)))
' MsgBox f
ShowLed CStr(f), 3
End Select
End If
Exit Sub
K:
MsgBox Err.Description
End Sub
Function ShowLed(j As String, typ As Integer)
If typ = 1 Then
If Mid(j, 8, 1) = 1 Then shape1.BackColor = vbRed Else shape1.BackColor = &H657EE2
If Mid(j, 7, 1) = 1 Then shape2.BackColor = vbRed Else shape2.BackColor = &H657EE2
If Mid(j, 6, 1) = 1 Then shape3.BackColor = vbRed Else shape3.BackColor = &H657EE2
If Mid(j, 5, 1) = 1 Then Shape4.BackColor = vbRed Else Shape4.BackColor = &H657EE2
End If
If typ = 2 Then
If Mid(j, 8, 1) = 1 Then shape11.BackColor = vbRed Else shape11.BackColor = &H657EE2
If Mid(j, 7, 1) = 1 Then shape22.BackColor = vbRed Else shape22.BackColor = &H657EE2
'If Mid(j, 6, 1) = 1 Then shape33.BackColor = vbRed Else shape33.BackColor = &H657EE2
'If Mid(j, 5, 1) = 1 Then Shape44.BackColor = vbRed Else Shape44.BackColor = &H657EE2
End If
If typ = 3 Then
If Mid(j, 8, 1) = 1 Then shape111.BackColor = vbRed Else shape111.BackColor = &H657EE2
If Mid(j, 7, 1) = 1 Then shape222.BackColor = vbRed Else shape222.BackColor = &H657EE2
'If Mid(j, 6, 1) = 1 Then shape333.BackColor = vbRed Else shape333.BackColor = &H657EE2
'If Mid(j, 5, 1) = 1 Then Shape444.BackColor = vbRed Else Shape444.BackColor = &H657EE2
End If
'If Replace(Mid(j, 6, 3), "0", "") = "11" Then
'Beep
'End If
End Function
Function Cbin(str As Integer) As String
atx = 0
For h = 0 To 1
For G = 0 To 1
For f = 0 To 1
For e = 0 To 1
For d = 0 To 1
For c = 0 To 1
For b = 0 To 1
For a = 0 To 1
z = h & G & f & e & d & c & b & a
If str = X Then
Cbin = z
Exit Function
End If
X = X + 1
Next
Next
Next
Next
Next
Next
Next
Next
End Function
Private Sub Text1_Change()
If Not IsNumeric(Text1.Text) Then Text1.Text = 0
If Text1.Text > 180 Then Text1.Text = 180
End Sub
Private Sub Timer1_Timer()
If Sender = "B" Then
Sender = "C"
GoTo G
End If
If Sender = "C" Then
Sender = "B"
GoTo G
End If
G:
Me.MSComm1.Output = Sender
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -