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

📄 frmalarm.frm

📁 回流焊监控系统-DCS,VB编写,对PLC进行通讯采集和控制,界面直观,操作方便,可以作为同类软件系统提供示范
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         Index           =   11
         Left            =   1733
         TabIndex        =   11
         Text            =   "0.0"
         Top             =   720
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   10
         Left            =   1080
         TabIndex        =   10
         Text            =   "0.0"
         Top             =   720
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   0
         Left            =   1080
         TabIndex        =   0
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   1
         Left            =   1733
         TabIndex        =   1
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   2
         Left            =   2386
         TabIndex        =   2
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   3
         Left            =   3039
         TabIndex        =   3
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   4
         Left            =   3692
         TabIndex        =   4
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   5
         Left            =   4345
         TabIndex        =   5
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   6
         Left            =   4998
         TabIndex        =   6
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   7
         Left            =   5651
         TabIndex        =   7
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   8
         Left            =   6304
         TabIndex        =   8
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.TextBox txtUT 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Index           =   9
         Left            =   6960
         TabIndex        =   9
         Text            =   "0.0"
         Top             =   240
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "上限设置:"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   44
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "下限设置:"
         Height          =   255
         Index           =   1
         Left            =   120
         TabIndex        =   43
         Top             =   840
         Width           =   975
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   5760
      TabIndex        =   41
      Top             =   3600
      Width           =   1095
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   375
      Left            =   1200
      TabIndex        =   40
      Top             =   3600
      Width           =   1095
   End
End
Attribute VB_Name = "frmAlarm"
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()
Dim ss As String
Dim j As Long, i As Long
On Error Resume Next
For i = 0 To iCurrentOption + 4
    txtUT(i).Text = Format(Val(frmMain.lbUT(i).Tag), "0.0")
    txtUT(i + 10).Text = Format(Val(frmMain.lbUTSet(i).Tag), "0.0")
    txtUT(i + 20).Text = Format(Val(frmMain.lbDT(i).Tag), "0.0")
    txtUT(i + 30).Text = Format(Val(frmMain.lbDTSet(i).Tag), "0.0")
Next
IsNotFirst = True
End Sub
Private Sub Form_Activate()
Dim i As Long, j As Long
SetDlgBackColor Me
j = iCurrentOption + 5
For i = 0 To Label2.UBound
  Label2(i).Visible = frmMain.lbUT(i).Visible
  txtUT(i).Visible = frmMain.lbUT(i).Visible
  txtUT(i + 10).Visible = frmMain.lbUT(i).Visible
  txtUT(i + 20).Visible = frmMain.lbUT(i).Visible
  txtUT(i + 30).Visible = frmMain.lbUT(i).Visible
Next
i = (5 - iCurrentOption) * (txtUT(1).Left - txtUT(0).Left)
Frame2(1).Visible = oOption(iCurrentOption).bOption(22)
Picture1.Width = 7695 - i
Frame2(0).Width = 7695 - i
Frame2(1).Width = 7695 - i
Me.Width = 8160 - i
CancelButton.Left = 5760 - i
If Not oOption(iCurrentOption).bOption(22) Then
  j = Frame2(1).Height
Else
  j = 0
End If
OKButton.Top = 3600 - j
CancelButton.Top = 3600 - j
Me.Height = 4470 - j
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call CancelButton_Click
Cancel = 1
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 Timer2_Timer()

Dim i As Long, j As Long
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
For j = 0 To txtUT.UBound
   If txtUT(j).Tag = "1" Then
    For i = 0 To 1
      ss = frmMain.PLCCommand(1, 6, DeviceAbsAdd("D" & 313 + j), CLng(Val(txtUT(j).Text) * 10), 0, "")
      If ss = "" Then
'        TimeDelay 300
        Delay 0.5
      Else
        txtUT(j).Tag = 0
        If j < 10 Then
          frmMain.lbUT(j).Tag = txtUT(j).Text
        ElseIf j < 20 Then
          frmMain.lbUTSet(j - 10).Tag = txtUT(j).Text
        ElseIf j < 30 Then
          frmMain.lbDT(j - 20).Tag = txtUT(j).Text
        ElseIf j < 40 Then
          frmMain.lbDTSet(j - 30).Tag = txtUT(j).Text
        End If
        WritePrivateProfileString "Alarm", "UT" & CStr(j), txtUT(j).Text, iniFile
        Exit For
      End If
    Next
    If ss = "" Then
         frmMain.sbStatusBar.Panels(1).Text = Time & " D" & 313 + j & "下载失败!"
         Call frmMain.AddErrorLog(frmMain.sbStatusBar.Panels(1).Text)
         
    End If
   End If
   frmInfo.ProgressBar1.Value = (j + 1) * 1000 / txtUT.Count
Next
GoTo Out
Errhandle:
  frmMain.sbStatusBar.Panels(1).Text = Time & "-超温报警设置 错误:" & Err.description
  Call frmMain.AddErrorLog(frmMain.sbStatusBar.Panels(1).Text)
  Err.Clear
Out:
OKButton.Enabled = True
frmInfo.Hide
bTimeEnd = False
Ack = False
End Sub

Private Sub txtUT_Change(Index As Integer)
If IsNotFirst Then
txtUT(Index).Tag = "1"
End If
End Sub

Private Sub txtUT_LostFocus(Index As Integer)
     If (Val(txtUT(Index).Text) < 0 Or Val(txtUT(Index).Text) > 50) Then
      MsgBox "报警设置值超限!", vbCritical + vbOKOnly, "警告"
      txtUT(Index).Text = 50
    End If
End Sub

⌨️ 快捷键说明

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