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

📄 ve-9e.tmp

📁 这是我自己用VB.NET编写的一款监护仪的电脑软件
💻 TMP
📖 第 1 页 / 共 3 页
字号:
        Dim MyPen As New Pen(Color.Gray, 1)

        e.FillRectangle(Mybrush, 10, 225, 1200 - 10, 50)    '画正常区,激发报警
        e.FillRectangle(Mybrush, 10, 225 + 210, 1200 - 10, 50)
        e.FillRectangle(Mybrush, 10, 140 + 435, 1200 - 10, 85)
        MyPen.DashStyle = Drawing2D.DashStyle.Dash
        For i As Integer = 0 To 1200 / 90 - 1
            MyRect1(i).X = 10 + i * 90
            MyRect1(i).Y = 125
            MyRect1(i).Width = 90
            MyRect1(i).Height = 190

            MyRect2(i).X = 10 + i * 90
            MyRect2(i).Y = 210 + 125
            MyRect2(i).Width = 90
            MyRect2(i).Height = 190

            MyRect3(i).X = 10 + i * 90
            MyRect3(i).Y = 435 + 125
            MyRect3(i).Width = 90
            MyRect3(i).Height = 100

            For j As Integer = 1 To 2
                e.DrawLine(MyPen, 10 + 90 * i + 30 * j, 0 + 125, 10 + 90 * i + 30 * j, 190 + 125)
                e.DrawLine(MyPen, 10 + 90 * i + 30 * j, 210 + 125, 10 + 90 * i + 30 * j, 400 + 125)
                e.DrawLine(MyPen, 10 + 90 * i + 30 * j, 435 + 125, 10 + 90 * i + 30 * j, 535 + 125)
            Next
        Next


        For i As Integer = 1 To 18
            e.DrawLine(MyPen, 10, i * 10 + 125, 1200 - 10, i * 10 + 125)
            e.DrawLine(MyPen, 10, i * 10 + 210 + 125, 1200 - 10, i * 10 + 210 + 125)
            If i < 10 Then
                e.DrawLine(MyPen, 10, i * 10 + 435 + 125, 1200 - 10, i * 10 + 435 + 125)
            End If
        Next


        e.DrawRectangles(Pens.Black, MyRect1)
        e.DrawRectangles(Pens.Black, MyRect2)
        e.DrawRectangles(Pens.Black, MyRect3)

        '标注坐标
        Dim Pos_Value As Integer = 240
        For i As Integer = 0 To 6
            For j As Integer = 0 To 1200 / 700
                e.DrawString(Pos_Value, New Font("黑体", 8, FontStyle.Italic), Brushes.Red, 492 + 700 * j, 120 + i * 30)
                e.DrawString(Pos_Value, New Font("黑体", 8, FontStyle.Italic), Brushes.Red, 492 + 700 * j, 120 + 210 + i * 30)
            Next
            Pos_Value -= 30
        Next
        Pos_Value = 100
        For i As Integer = 0 To 5
            For j As Integer = 0 To 1200 / 700
                e.DrawString(Pos_Value, New Font("黑体", 8, FontStyle.Italic), Brushes.Red, 492 + 700 * j, 120 + 435 + i * 20)
            Next
            Pos_Value -= 20
        Next
        e.DrawString("胎心音1", New Font("宋体", 9), Brushes.Red, 20, 189 + 125)
        e.DrawString("胎心音2", New Font("宋体", 9), Brushes.Red, 20, 401 + 125)
        e.DrawString("宫压", New Font("宋体", 9), Brushes.Red, 20, 536 + 125)



        '######################################################3
    End Sub

    Private Sub Print_Image_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print_Image.Click
        PrintF.Begin_Print.Enabled = True
        PrintF.GroupBox3.Enabled = False
        PrintF.Print_ComboBox.Enabled = False
        PrintF.CheckBox1.Enabled = False
        PrintF.ShowDialog()
    End Sub
    Dim F8 As Byte
    Dim Read_Data(Point_Count * 4) As Byte
    Dim FHR11(Point_Count) As Byte
    Dim FHR21(Point_Count) As Byte
    Dim UC1(Point_Count) As Byte
    Dim MyBmp As New Bitmap(8000, 600)
    Private Sub DisPlayAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisPlayAll.Click
        If Me.DisPlayAll.Text = "显示全部图像" Then
            Me.DisPlayAll.Text = "恢复正常视图"
            On Error Resume Next
            Dim MyFS1 As FileStream = File.Open(MyPath, FileMode.Open, FileAccess.Read)
            Dim MySR As New BinaryReader(MyFS1)
            Me.PictureBox1.Width = Point_Count
            Dim MyDrawPic As Graphics = Graphics.FromImage(MyBmp)
            ' ************************

            Dim read_Count = 0
            On Error Resume Next
            Read_Data = MySR.ReadBytes(Point_Count * 4)
            MySR.Close()
            MyFS1.Close()
            ReDim FHR11(Read_Data.Length / 4)
            ReDim FHR21(Read_Data.Length / 4)
            ReDim UC1(Read_Data.Length / 4)
            For i As Integer = 1 To Read_Data.Length - 1 Step 4
                FHR11(read_Count) = Read_Data(i)
                FHR21(read_Count) = Read_Data(i + 1)
                UC1(read_Count) = Read_Data(i + 2)
                read_Count += 1
            Next

            ' @@@@@@@@@@@@@@@@@@@@@@@@@@@@重绘部分代码

            For i As Integer = 1 To FHR11.Length - 2
                If FHR11(i - 1) <> &HFF Then
                    If FHR11(i) <> &HFF Then
                        MyDrawPic.DrawLine(Pens.Black, i + 1, 80 + FHR11(i - 1), i + 2, 80 + FHR11(i))
                        MyDrawPic.DrawLine(Pens.Black, i + 1, 210 + 80 + FHR21(i - 1), i + 2, 210 + 80 + FHR21(i))
                        MyDrawPic.DrawLine(Pens.Black, i + 1, 435 + 10 + UC1(i - 1), i + 2, 435 + 10 + UC1(i))
                    End If

                End If
            Next

            '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


            Me.PictureBox1.Image = Nothing
            Me.PictureBox1.Image = MyBmp
            Me.PictureBox1.Refresh()
            Me.HScrollBar1.Visible = True
        Else
            Me.DisPlayAll.Text = "显示全部图像"
            Me.PictureBox1.Width = 725
            Me.PictureBox1.Refresh()
            Me.PictureBox1.Image = bmp

            Me.HScrollBar1.Visible = False
            Me.PictureBox1.Left = 0
        End If
    End Sub


    Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
        If Me.PictureBox1.Width > 640 Then
            Me.HScrollBar1.Maximum = Me.PictureBox1.Width - 640
        Else
            Me.HScrollBar1.Maximum = 200
        End If

        Me.PictureBox1.Left = -Me.HScrollBar1.Value
    End Sub
    '************************测试用数据,以下程序仅供测试
    '**************************************************
    Dim Exp_Data(3) As Byte
    Dim a As Single = 0
    Dim b = 0
    Dim c = 0
    Private Sub Timer_Ceshi_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_Ceshi.Tick

        Exp_Data(0) = &HF8
        Exp_Data(1) = Math.Round(30 * Math.Sin(a / 15.0) + 30)
        Exp_Data(2) = Math.Round(30 * Math.Cos(a / 15.0) + 30)
        Exp_Data(3) = b
        If Not SPort.IsOpen Then
            SPort.Open()
        End If
        SPort.Write(Exp_Data, 0, 4)
        a += 1
        c += 1
        If c = 50 Then
            c = 0
            If b = 0 Then
                b = 50
            Else
                b = 0
            End If
        End If
    End Sub

    Dim MyBytes() As Byte = New Byte(3) {&HF8, &HFF, &HFF, &HFF}  '无数据点用FF表示
    Dim MyTime() As String
    Dim WriteBuffer(0) As Byte   '每隔100个点写入一次硬盘

    Private Sub DataTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataTimer.Tick

        '&&&&&&&&&&&&&&&&&**************显示与打印分开,打印必须延时**************&&&&&&&&&&&&&&&&&
        If Me.Start_Obv.Text = "暂停" Then
            If X_Pos >= 2 Then  '放弃开始两个点
                Using MyDraw As Graphics = Graphics.FromImage(bmp)
                    Dim myp As New Pen(Color.Black, 3)
                    MyDraw.FillRectangle(Brushes.White, X_Pos, 0, 10, 550)
                    MyDraw.DrawLine(myp, X_Pos - 1, 80 + FHR1(1 - Arr_Count), X_Pos, 80 + FHR1(Arr_Count))
                    MyDraw.DrawLine(myp, X_Pos - 1, 210 + 80 + FHR2(1 - Arr_Count), X_Pos, 210 + 80 + FHR2(Arr_Count))
                    MyDraw.DrawLine(myp, X_Pos - 1, 435 + 10 + UC(1 - Arr_Count), X_Pos, 435 + 10 + UC(Arr_Count))
                    Me.PictureBox1.Image = bmp
                End Using
            End If
        ElseIf Me.Start_Obv.Text = "恢复" Then
            If X_Pos >= 2 Then
                Using MyDraw As Graphics = Graphics.FromImage(bmp)
                    MyDraw.FillRectangle(Brushes.White, X_Pos, 0, 10, 550)
                    Me.PictureBox1.Image = bmp
                End Using
            End If
        End If
        '&&&&&&&&&&&&&&&&&****************************&&&&&&&&&&&&&&&&&
        '&&&&&&&&&&&&&&&&&&&&&&&*********************&&&&&&&&&&&&&&&&&&&&&&&&&&


        If Arr_Count = 0 Then
            Arr_Count = 1
        Else
            Arr_Count = 0
        End If

        X_Pos += 1
        If X_Pos > 654 Then
            X_Pos = 2
        End If


        '***************************暂存数
        For i As Integer = 0 To 3
            Me.RichTextBox1.Text += Hex(BuffData(i)) + " "
        Next
        Me.RichTextBox1.Text += "   "
        FHR1(Arr_Count) = BuffData(1)
        FHR2(Arr_Count) = BuffData(2)
        UC(Arr_Count) = BuffData(3)
        '***************************************






        '绘制刻度时间计数
        Page_Count = CInt(Point_Count / 180)
        If Point_Count Mod 180 = 1 Then
            ReDim Preserve MyTime(Page_Count)
            MyTime(Page_Count) = Now.ToLongDateString + " " + Now.ToLongTimeString
        End If

        If X_Pos >= 2 Then
            Point_Count += 1
            ReDim Preserve WriteBuffer(Point_Count * 4 - 1)
            '******************************************   '写入硬盘的数据
            If Me.Start_Obv.Text = "暂停" Then
                On Error Resume Next
                For i As Integer = 0 To 3
                    WriteBuffer(Point_Count * 4 - 1 - i) = BuffData(3 - i)
                Next

            ElseIf Me.Start_Obv.Text = "恢复" Then
                On Error Resume Next
                For i As Integer = 0 To 3
                    WriteBuffer(Point_Count * 4 - 1 - i) = MyBytes(3 - i)
                Next
            End If
            '*******************************************
        End If

    End Sub

    Private Sub Obv_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Obv_Timer.Tick
        If Me.Start_Obv.Text <> "开始监护" Then
            Dim Mytmp As Integer
            Mytmp = Convert.ToInt32(Val(Me.Obv_time.Text))
            Me.Obv_Left.Text = Math.Floor((Mytmp * 60 - Time_Tick) / 60) & "分" & (Mytmp * 60 - Time_Tick) Mod 60 & "秒"
            Time_Tick += 1
        End If
        If Me.Obv_Left.Text = "0分0秒" Then
            Me.Stop_obv_Click(Nothing, Nothing)
        End If
    End Sub

    Private Sub PrintPreviewDialog1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles PrintPreviewDialog1.FormClosing
        PrintF.Close()
        Me.Show()
    End Sub

    Private Sub PrintPreviewDialog1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewDialog1.Load
        PrintF.Close()
        Me.PrintPreviewDialog1.Document = Me.PrintDocument1
        Me.PrintPreviewDialog1.Document.DocumentName = CInt(Point_Count / Paper_Length + 1) '共几页
        Me.PrintPreviewDialog1.Document.DefaultPageSettings.Landscape = True
    End Sub
End Class

⌨️ 快捷键说明

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