📄 form1.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 330
Left = 3780
TabIndex = 6
Top = 135
Width = 690
End
Begin VB.Label Label11
BackColor = &H00DEEBEF&
Caption = "0.00"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 330
Left = 1320
TabIndex = 5
Top = 135
Width = 675
End
Begin VB.Label Label10
BackColor = &H00DEEBEF&
Caption = "当前温度值: C; 温度设定值: C 动作时间: "
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 90
TabIndex = 4
Top = 180
Width = 7395
End
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 600
Left = 1845
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 1170
Visible = 0 'False
Width = 2220
End
Begin VB.Frame Frame1
Height = 615
Left = 135
TabIndex = 2
Top = 5760
Width = 7965
Begin 炉温自动控制系统.xpcmdbutton xpcmdbutton7
Height = 420
Left = 6885
TabIndex = 31
Top = 135
Width = 960
_ExtentX = 1693
_ExtentY = 741
Caption = "清除时间"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin 炉温自动控制系统.xpcmdbutton xpcmdbutton6
Height = 420
Left = 5535
TabIndex = 30
Top = 135
Width = 1185
_ExtentX = 2090
_ExtentY = 741
Caption = "清空数据库"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin 炉温自动控制系统.xpcmdbutton xpcmdbutton5
Height = 420
Left = 4410
TabIndex = 29
Top = 135
Width = 960
_ExtentX = 1693
_ExtentY = 741
Caption = "参数设置"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin 炉温自动控制系统.xpcmdbutton xpcmdbutton4
Height = 420
Left = 3330
TabIndex = 28
Top = 135
Width = 960
_ExtentX = 1693
_ExtentY = 741
Caption = "串口设置"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin 炉温自动控制系统.xpcmdbutton xpcmdbutton3
Height = 420
Left = 2205
TabIndex = 27
Top = 135
Width = 960
_ExtentX = 1693
_ExtentY = 741
Caption = "打印图像"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin 炉温自动控制系统.xpcmdbutton xpcmdbutton2
Height = 420
Left = 1125
TabIndex = 26
Top = 135
Width = 960
_ExtentX = 1693
_ExtentY = 741
Caption = "数据查询"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin 炉温自动控制系统.xpcmdbutton xpcmdbutton1
Height = 420
Left = 90
TabIndex = 25
Top = 135
Width = 915
_ExtentX = 1614
_ExtentY = 741
Caption = "打开串口"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Begin cstTrend.Trend Trend1
Height = 3615
Left = 135
TabIndex = 1
Top = 2115
Width = 7980
_ExtentX = 14076
_ExtentY = 6376
BackColor = 11789154
AreaLeft = 0.09
AreaRight = 0.96
AreaTop = 0.06
BufferSize = 300
TrackSeparation = 0.23
XMax = 4.16666666666667E-02
XMin = 0
XEnd = 4.16666666666667E-02
XStart = 0
XSpan = 4.16666666666667E-02
XDataType = 2
XMajorTicNum = 9
XMinorTicNum = 5
XLabelFormat = "hh:mm:ss"
MajorTicLen = 5
MinorTicLen = 5
BackPicture0 = "Form1.frx":0000
YMax0 = 100
YEnd0 = 100
YStart0 = 0
YMajorTicNum0 = 9
YMinorTicNum0 = 5
LineWidth0 = 2
BeginProperty Font0 {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
OutLineWidth = 0
BorderWidth = 2
End
End
Begin VB.Timer Timer3
Enabled = 0 'False
Interval = 1000
Left = 6525
Top = 2655
End
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 100
Left = 6960
Top = 4410
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 6885
Top = 3690
End
Begin MSCommLib.MSComm MSComm1
Left = 4905
Top = 2700
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
RThreshold = 1
BaudRate = 4800
SThreshold = 1
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim IdSound As Integer
Dim Str(0) As Byte
Dim temp(2) As Integer
Dim Temper, Value1, deltaPn, PIDvalue, TimeValue As Double
Dim Value As Integer
Dim Style, First, StartHost As Boolean
Dim H, m, s, SoundTime As Integer
Dim Num, GroupNum As Integer
Dim Tim
Dim p As PointAPI
Private Sub comport_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call GetCursorPos(p)
Call WritePos
End Sub
Private Sub Command2_Click()
IcMisSound1.PlaySnd 55
End Sub
Private Sub Form_Load()
If App.PrevInstance Then
MsgBox ("程序已经运行,不能再次装载!"), vbExclamation
Unload Me
End If
H = 0
m = 0
s = 1
Num = 0
First = True
StartHost = False
ClearDatabase = False
Trend1.BufferSize = 800
Timer1.Enabled = False
MSComm1.Settings = GetSetting(App.Title, "Properties", "Settings")
Label2.Caption = "[" & Form1.MSComm1.Settings & "]"
MSComm1.CommPort = GetSetting(App.Title, "Properties", "CommPort", 1)
Label3.Caption = Form1.MSComm1.CommPort
MSComm1.Handshaking = GetSetting(App.Title, "Properties", "Handshaking", 0)
Select Case Form1.MSComm1.Handshaking
Case 0
Form1.Label4.Caption = "不使用"
Case 1
Form1.Label4.Caption = "握手协议"
Case 2
Form1.Label4.Caption = "请求,清除"
Case 3
Form1.Label4.Caption = "两者"
End Select
Set db = Workspaces(0).OpenDatabase(App.Path + "/control.mdb")
Set td = db.TableDefs("control")
Set Rs = td.OpenRecordset
For i = 0 To 2 '读放PID的值
Label6(i).Caption = CStr(Rs.Fields(i).Value)
Next
GroupNum = CInt(Rs.Fields(4).Value)
GroupNum = GroupNum + 1
Text1.Text = CInt(Rs.Fields(3).Value) '读入周期值
Set db = Workspaces(0).OpenDatabase(App.Path + "/control.mdb") '读设定温度值
Set td = db.TableDefs("settemp")
Set Rs = td.OpenRecordset
Label12.Caption = CDbl(Rs.Fields(0).Value)
If MSComm1.PortOpen = True Then
StatusBar1.Panels(1).Text = "当前串口状态:打开"
ElseIf MSComm1.PortOpen = False Then
StatusBar1.Panels(1).Text = "当前串口状态:关闭"
End If
With MSComm1
.InputMode = 1 '设置接受数据的类型是二进制类型数据
.InputLen = 8 '一次性从接收缓冲区中读取所有数据(8个字节为一组!!)
.InBufferCount = 0 '清空接收缓冲区
.OutBufferCount = 0 '清空发送缓冲区
.RThreshold = 1 '接收1个字节数据触发OnComm()事件
.CommPort = 1
End With
Tim = Time
StatusBar1.Panels(2).Text = "最大值:" & Format$(Trend1.StatMax(0), "00.0") & " 最小值:" & Format$(Trend1.StatMin(0), "00.0") _
& " " & "平均值:" & Format$(Trend1.StatAvg(0), "00.0")
Trend1.XMin = Time - Tim
Trend1.XMax = Trend1.XMin + 1 / 24 / 6 * CInt(Text1.Text) * 5 / 60
Trend1.XStart = Trend1.XMin
Trend1.XEnd = Trend1.XMin + 1 / 24 / 6 * CInt(Text1.Text) * 5 / 60
Trend1.XSpan = 1 / 24 / 6 * CInt(Text1.Text) * 5 / 60
'IcMisSound1.PlaySnd 142
End Sub
Public Sub CheckComm()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
xpcmdbutton1.Caption = "打开串口"
StatusBar1.Panels(1).Text = "当前串口状态:关闭"
ElseIf MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
xpcmdbutton1.Caption = "关闭串口"
StatusBar1.Panels(1).Text = "当前串口状态:打开"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set db = Workspaces(0).OpenDatabase(App.Path + "/control.mdb")
Set td = db.TableDefs("control")
Set Rs = td.OpenRecordset
Rs.Edit
If ClearDatabase = True Then
GroupNum = 0
End If
Rs.Fields(4).Value = CStr(GroupNum)
Rs.Update
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
End If
Str(0) = CByte(Asc("p"))
MSComm1.Output = Str
Str(0) = CByte(1)
MSComm1.Output = Str
MSComm1.PortOpen = False
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call GetCursorPos(p)
Call WritePos
End Sub
Private Sub Frame2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call GetCursorPos(p)
Call WritePos
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -