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

📄 frmtswitch.frm

📁 回流焊监控系统-DCS,VB编写,对PLC进行通讯采集和控制,界面直观,操作方便,可以作为同类软件系统提供示范
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmTswitch 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "温区开关"
   ClientHeight    =   4860
   ClientLeft      =   5910
   ClientTop       =   3765
   ClientWidth     =   4335
   Icon            =   "frmTswitch.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4860
   ScaleWidth      =   4335
   ShowInTaskbar   =   0   'False
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   100
      Left            =   0
      Top             =   0
   End
   Begin VB.Timer Timer1 
      Interval        =   500
      Left            =   0
      Top             =   0
   End
   Begin VB.PictureBox Picture1 
      Height          =   3975
      Left            =   120
      ScaleHeight     =   3915
      ScaleWidth      =   4035
      TabIndex        =   22
      Top             =   120
      Width           =   4095
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区10"
         Height          =   255
         Index           =   19
         Left            =   2280
         TabIndex        =   19
         Top             =   3480
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区9"
         Height          =   255
         Index           =   18
         Left            =   2280
         TabIndex        =   18
         Top             =   3120
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区8"
         Height          =   255
         Index           =   17
         Left            =   2280
         TabIndex        =   17
         Top             =   2760
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区7"
         Height          =   255
         Index           =   16
         Left            =   2280
         TabIndex        =   16
         Top             =   2400
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区6"
         Height          =   255
         Index           =   15
         Left            =   2280
         TabIndex        =   15
         Top             =   2040
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区5"
         Height          =   255
         Index           =   14
         Left            =   2280
         TabIndex        =   14
         Top             =   1680
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区4"
         Height          =   255
         Index           =   13
         Left            =   2280
         TabIndex        =   13
         Top             =   1320
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区3"
         Height          =   255
         Index           =   12
         Left            =   2280
         TabIndex        =   12
         Top             =   960
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区2"
         Height          =   255
         Index           =   11
         Left            =   2280
         TabIndex        =   11
         Top             =   600
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "下温区1"
         Height          =   255
         Index           =   10
         Left            =   2280
         TabIndex        =   10
         Top             =   240
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区10"
         Height          =   255
         Index           =   9
         Left            =   360
         TabIndex        =   9
         Top             =   3480
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区9"
         Height          =   255
         Index           =   8
         Left            =   360
         TabIndex        =   8
         Top             =   3120
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区8"
         Height          =   255
         Index           =   7
         Left            =   360
         TabIndex        =   7
         Top             =   2760
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区7"
         Height          =   255
         Index           =   6
         Left            =   360
         TabIndex        =   6
         Top             =   2400
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区6"
         Height          =   255
         Index           =   5
         Left            =   360
         TabIndex        =   5
         Top             =   2040
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区5"
         Height          =   255
         Index           =   4
         Left            =   360
         TabIndex        =   4
         Top             =   1680
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区4"
         Height          =   255
         Index           =   3
         Left            =   360
         TabIndex        =   3
         Top             =   1320
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区3"
         Height          =   255
         Index           =   2
         Left            =   360
         TabIndex        =   2
         Top             =   960
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区2"
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   1
         Top             =   600
         Width           =   1215
      End
      Begin VB.CheckBox ckTemp 
         Caption         =   "上温区1"
         Height          =   255
         Index           =   0
         Left            =   360
         TabIndex        =   0
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   2520
      TabIndex        =   21
      Top             =   4320
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   375
      Left            =   360
      TabIndex        =   20
      Top             =   4320
      Width           =   1215
   End
End
Attribute VB_Name = "frmTswitch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim IsNotFirst As Boolean
Private Sub CancelButton_Click()
 Me.Hide
 frmMain.Enabled = True
End Sub

Private Sub Form_Load()
bTimeEnd = True
OKButton.Enabled = False
End Sub
Private Sub Form_Activate()
Dim i As Long
SetDlgBackColor Me
For i = 0 To 9
  ckTemp(i).Visible = frmMain.lbUT(i).Visible
  ckTemp(i + 10).Visible = frmMain.lbDT(i).Visible
Next
i = (5 - iCurrentOption) * (ckTemp(1).Top - ckTemp(0).Top)
Picture1.Height = 3975 - i
CancelButton.Top = 4320 - i
OKButton.Top = 4320 - i
Me.Height = 5235 - i

End Sub
Private Sub Form_Unload(Cancel As Integer)
Call CancelButton_Click
Cancel = 1
End Sub

Private Sub ckTemp_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If IsNotFirst Then
ckTemp(Index).Tag = "1"
End If
End Sub

Private Sub OKButton_Click()

If bTimeEnd Then
 Exit Sub
End If
frmMain.sbStatusBar.Panels(1).Text = ""
bTimeEnd = True
OKButton.Enabled = False
Timer2.Enabled = True
End Sub

Private Sub Timer1_Timer()
Dim ss As String
Dim j As Long, i As Long

If (Not Ack) Then
Exit Sub
End If
Timer1.Enabled = False
For i = 0 To 1
    ss = frmMain.PLCCommand(1, 3, DeviceAbsAdd("D269"), 10, 0, "")
    If ss <> "" Then
      ss = Mid(ss, 8, 10 * 4)
      For j = 0 To 9
        If Hex2Dec(Mid(ss, 4 * j + 1, 4)) = 10 Then
         ckTemp(j).Value = 1
        Else
         ckTemp(j).Value = 0
        End If
      Next
      Exit For
    End If
    TimeDelay 300
Next
For i = 0 To 1
    ss = frmMain.PLCCommand(1, 3, DeviceAbsAdd("D279"), 10, 0, "")
    If ss <> "" Then
      ss = Mid(ss, 8, 10 * 4)
      For j = 0 To 9
        If Hex2Dec(Mid(ss, 4 * j + 1, 4)) = 10 Then
         ckTemp(j + 10).Value = 1
        Else
         ckTemp(j + 10).Value = 0
        End If
      Next
      Exit For
    End If
    TimeDelay 300
Next

bTimeEnd = False
OKButton.Enabled = True
IsNotFirst = True
Ack = False
End Sub

Private Sub Timer2_Timer()
Dim i As Long, j As Long, k As Long
Dim a As Boolean
Dim ss As String
On Error GoTo Errhandle
If Not Ack Then
  Exit Sub
End If
Timer2.Enabled = False
frmInfo.Show , Me
frmInfo.ProgressBar1.Value = 0
k = 0
For j = 0 To ckTemp.UBound '6
     If ckTemp(j).Tag = "1" Then
       TimeDelay 100
       If ckTemp(j).Value = 1 Then
         k = 10
       Else
         k = 0
       End If
       For i = 1 To 3
        ss = frmMain.PLCCommand(1, 6, DeviceAbsAdd("D" & 269 + j), k, 0, "")
        If ss = "" Then
          TimeDelay 300
        Else
          WritePrivateProfileString "Tswitch", CStr(j), CStr(ckTemp(j).Value), iniFile
          ckTemp(j).Tag = "0"
          Exit For
        End If
       Next
       frmInfo.ProgressBar1.Value = j * 1000 / ckTemp.Count
       If ss = "" Then
         frmMain.sbStatusBar.Panels(1).Text = Time & " D" & 269 + j & "下载失败!"
         Call frmMain.AddErrorLog(frmMain.sbStatusBar.Panels(1).Text)
       End If
     End If
Next

GoTo Out
Errhandle:
  frmMain.sbStatusBar.Panels(1).Text = Time & "-温区开关 错误:" & Err.description
  Call frmMain.AddErrorLog(frmMain.sbStatusBar.Panels(1).Text)
  Err.Clear
Out:

frmInfo.ProgressBar1.Value = 1000
OKButton.Enabled = True
frmInfo.Hide
bTimeEnd = False
Ack = False
End Sub

⌨️ 快捷键说明

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