📄 mainform.vb
字号:
Private Sub SysQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SysQuit.Click
If Me.Start_Obv.Text <> "Start" Then
MessageBox.Show("Please stop monitoring first and then quit the system!", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
Else
If Point_Count < 5 Then
Close()
End If
If File_Flag = 0 Then
Dim n As MsgBoxResult = MessageBox.Show("Do you want to save the present monitoring images?", "Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
If n = MsgBoxResult.Cancel Then
Exit Sub
ElseIf n = MsgBoxResult.Yes Then
If Me.Prag_Name.Text = "" Or Me.Prag_Name.Text = "Not set" Then
MessageBox.Show("You must make out the patient file first! !", "save", MessageBoxButtons.OK)
Exit Sub
End If
Me.ImageSave_Click(Nothing, Nothing)
End If
End If
End If
On Error Resume Next
Close()
End Sub
Private Sub LinkLabel2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel2.Click
AboutBox1.ShowDialog()
End Sub
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Me.PictureBox1.Left = -Me.HScrollBar1.Value
End Sub
Public Sub ImageSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImageSave.Click
Try
If Me.File_Flag = 1 Then
MessageBox.Show("Youri mage has already been saved!", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
End If
If Point_Count < 3 Then
MessageBox.Show("No image for saving!")
Exit Sub
End If
If Me.Prag_Name.Text = "" Or Me.Prag_Name.Text = "Not set" Then
Me.Auto_Save = True
DangAn.ShowDialog()
Exit Sub
Else
Me.Auto_Save = False
End If
Dim FolderName As String = Me.Prag_Name.Text & "(" & Format(Now, "yyyy.MM.dd HH.mm.ss") & ")"
Dim MyImageName As String = "ImageIndex"
Dim MyFolder As String = Application.StartupPath & "\data\" & FolderName
IO.Directory.CreateDirectory(MyFolder)
For i As Integer = 1 To bmp.Length
bmp(i - 1).Save(MyFolder & "\" & MyImageName & "(" & i & ").gif", Imaging.ImageFormat.Gif)
Next
Dim MyFileInfo As String = MyFolder & "\ImageInfo.bstm"
Dim MyString As String = Me.Prag_Name.Text & vbCrLf
MyString += Me.Prag_HosID.Text & vbCrLf
MyString += Me.Prag_BedID.Text & vbCrLf
MyString += Me.Prag_week.Text & vbCrLf
MyString += Me.Print_rate.Text & vbCrLf
MyString += Me.Obv_Left.Text & vbCrLf & Me.RichTextBox1.Text
Dim myStream As FileStream = File.Create(MyFileInfo)
myStream.Close()
File.AppendAllText(MyFileInfo, MyString)
Catch ex As Exception
MessageBox.Show("Failed to save!")
Exit Sub
End Try
MessageBox.Show("File saved successfully! The file has been saved to the new directory in the 'Data' folder!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information)
File_Flag = 1
End Sub
Dim Mrr_Count As Integer = 0
Dim Mrr1_Count As Integer = 0
Dim Error_Count As Integer = 0
Dim Error1_Count As Integer = 0
Private Sub ReceiveTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReceiveTimer.Tick
If Me.Start_Obv.Text = "Pause" Then
'数码显示
If BuffData(1) <= 240 And BuffData(2) <= 240 Then
If SystemSet.CheckBox4.Checked = True Then
Me.FHR_1.Text = BuffData(1)
End If
If SystemSet.CheckBox5.Checked = True Then
Me.FHR_2.Text = BuffData(2)
End If
End If
If SystemSet.CheckBox6.Checked = True Then
If BuffData(3) >= 95 And BuffData(3) < 100 Then
Me.UC_Obv.Text = BuffData(3) + 1
Else
Me.UC_Obv.Text = BuffData(3)
End If
End If
If X_Pos >= 775 Then
Me.PictureBox1.Left = 775 - X_Pos
Me.HScrollBar1.Value = -Me.PictureBox1.Left
Else
Me.PictureBox1.Left = 0
Me.HScrollBar1.Value = 0
End If
End If
'绘制刻度时间计数
Time_Count = Math.Floor(Point_Count / 120)
'计算共有几页
Page_Count = Math.Floor(Point_Count / 1080)
ReDim Preserve bmp(Page_Count)
If Point_Count Mod 1080 = 0 Then
bmp(Page_Count) = New Bitmap(1088, 635)
End If
'画Mark标记
Using MyDraw As Graphics = Graphics.FromImage(bmp(Page_Count))
If Mark_State = 1 Then
Mark_State = 0
MyDraw.DrawImage(Me.ImageList2.Images(0), X_Pos, 370)
End If
If Mark_State = 2 Then
Mark_State = 0
MyDraw.DrawImage(Me.ImageList2.Images(1), X_Pos, 385)
End If
End Using
If Me.Start_Obv.Text = "Pause" Then
On Error Resume Next
' If SystemSet.CheckBox2.Checked = True Then
'探头脱落报警
'If BuffData(1) <= 10 Or BuffData(3) <= 1 Then '空数据发送格式&HFF 00 00 0A
' Err_Off += 1
'End If
' If Err_Off > 25 Then
'Err_Off = 0
' Beep()
' Me.Start_Obv_Click(Nothing, Nothing)
' MessageBox.Show("探头脱落,请重新连接!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
' Exit Sub
' End If
' End If
If SystemSet.CheckBox4.Checked = True Then
If BuffData(1) > SystemSet.ComboBox1.Text Or BuffData(1) < SystemSet.ComboBox2.Text Then
Error_Count += 1
If Error_Count >= 7 Then
Error_Count = 0
End If
If Error_Count = 5 Then
If Mrr_Count = 0 Then
Mrr_Count = 1
Else
Mrr_Count = 0
End If
Me.FHR_1.ForeColor = Color.Red
If Mrr_Count = 0 Then
Me.FHR_1.Visible = False '闪烁效果
Else
Me.FHR_1.Visible = True
End If
End If
Else
Me.FHR_1.Visible = True
Me.FHR_1.ForeColor = Color.Black
End If
End If
If SystemSet.CheckBox5.Checked = True Then
If BuffData(2) > SystemSet.ComboBox1.Text Or BuffData(2) < SystemSet.ComboBox2.Text Then
Error1_Count += 1
If Error1_Count >= 7 Then
Error1_Count = 0
End If
If Error1_Count = 5 Then
If Mrr1_Count = 0 Then
Mrr1_Count = 1
Else
Mrr1_Count = 0
End If
Me.FHR_2.ForeColor = Color.Red
If Mrr1_Count = 0 Then
Me.FHR_2.Visible = False '闪烁效果
Else
Me.FHR_2.Visible = True
End If
End If
Else
Me.FHR_2.Visible = True
Me.FHR_2.ForeColor = Color.Black
End If
End If
If SystemSet.CheckBox1.Checked = True Then
If Error_Count = 6 Or Error1_Count = 6 Then
Error_Count = 0
Error1_Count = 0
Beep()
End If
'心率报警
End If
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Me.ComboBox1.Text = Nothing Then
Exit Sub
End If
If Me.ComboBox1.Text < bmp.Length Then
Me.PictureBox1.Image = bmp(Me.ComboBox1.Text)
Me.ComboBox1.Text += 1
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.ComboBox1.Text = Nothing Then
Exit Sub
End If
If Me.ComboBox1.Text > 1 And Me.ComboBox1.Text = bmp.Length Then
Me.PictureBox1.Image = bmp(Me.ComboBox1.Text - 1)
Me.ComboBox1.Text -= 1
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If Me.ComboBox1.Text = Nothing Then
Exit Sub
End If
If Me.ComboBox1.Text >= 1 And Me.ComboBox1.Text <= bmp.Length Then
Me.PictureBox1.Image = bmp(Me.ComboBox1.Text - 1)
End If
End Sub
Private Sub MonthCalendar1_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
Me.DateFile.Text = Format(Me.MonthCalendar1.SelectionStart.Date, "yyyy.MM.dd")
Me.MonthCalendar1.Visible = False
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim AllFiles() As String = IO.Directory.GetDirectories(Application.StartupPath & "\Data", Me.SearchPreg_Name.Text & "(" & Me.DateFile.Text & "*")
Me.ComboBox2.Text = AllFiles.Length & " Recordes found!"
Me.ComboBox2.Focus()
Me.ButtonOpenFile.Enabled = False
Me.DateFile.Text = Nothing
Me.ComboBox2.Items.Clear()
For i As Integer = 0 To AllFiles.Length - 1
Dim tempString() As String = AllFiles(i).Split("\Data\")
Me.ComboBox2.Items.Add(tempString(tempString.Length - 1))
Next
End Sub
Private Sub ComboBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.TextChanged
If Me.ComboBox2.Text <> Nothing Then
Me.ButtonOpenFile.Enabled = True
Else
Me.ButtonOpenFile.Enabled = False
End If
End Sub
Private Sub ButtonOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOpenFile.Click
Dim OpenFileName As String = Application.StartupPath & "\Data\" & Me.ComboBox2.Text & "\ImageInfo.bstm"
Try
Dim MyTextInfo() As String = File.ReadAllLines(OpenFileName, System.Text.Encoding.UTF8)
Me.Prag_Name.Text = MyTextInfo(0)
Me.Prag_HosID.Text = MyTextInfo(1)
Me.Prag_BedID.Text = MyTextInfo(2)
Me.Prag_week.Text = MyTextInfo(3)
Me.Print_rate.Text = MyTextInfo(4)
Me.Obv_Left.Text = MyTextInfo(5)
Me.RichTextBox1.Text = ""
For i As Integer = 6 To MyTextInfo.Length - 1
Me.RichTextBox1.Text += MyTextInfo(i)
Next
OpenFileName = IO.Directory.GetParent(OpenFileName).ToString '用来保存父路径
Dim i_Count As Integer = 0
While (1)
ReDim Preserve bmp(i_Count)
bmp(i_Count) = Image.FromFile(OpenFileName & "\ImageIndex(" & i_Count + 1 & ").gif")
i_Count += 1
If Not File.Exists(OpenFileName & "\ImageIndex(" & i_Count + 1 & ").gif") Then
Exit While
End If
End While
Me.ComboBox1.Items.Clear()
For i As Integer = 1 To bmp.Length
Me.ComboBox1.Items.Add(i)
Next
Me.ComboBox1.Text = 1
Me.Total_Page.Text = bmp.Length & " Page total"
Me.PictureBox1.Image = bmp(0)
Me.HScrollBar1.Value = 0
File_Flag = 1 '防止重复保存文件
Point_Count = -1
Print_Image.Enabled = True
Print_Image.BackColor = Color.LimeGreen
Catch ex As Exception
MessageBox.Show("Failed to open it!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Me.ButtonOpenFile.Enabled = False
Exit Try
End Try
Me.ButtonOpenFile.Enabled = False
End Sub
Private Sub DateFile_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateFile.GotFocus
Me.MonthCalendar1.Visible = True
End Sub
Private Sub DateFile_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateFile.LostFocus
If Me.MonthCalendar1.Focused Then
Exit Sub
End If
Me.MonthCalendar1.Visible = False
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -