1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
| Imports System.IO
Public Class Form1
Dim tab As String
Dim tab2 As Double
Dim taille
Dim min, max, h, scale1 As Double
Private Sub Visualisation_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Visualisation.Click
Dim loaddialog As New OpenFileDialog
With loaddialog
.Filter = "Fichiers DAT (*.dat)|*.dat"
.FilterIndex = 1
.ShowDialog()
If .ShowDialog = DialogResult.OK Then
Dim filename As String
filename = .FileName
Dim lignes() As String = File.ReadAllLines(filename)
Dim taille = lignes.Length
Dim tab(taille) As String
Dim tab2(taille) As Double
Dim monStreamReader As StreamReader = New StreamReader(filename)
Dim ligne As String
For i = 0 To taille - 1
ligne = monStreamReader.ReadLine()
tab(i) = ligne
Next
monStreamReader.Close()
For i = 0 To taille - 1
tab2(i) = CType(tab(i), Double)
Next
min = tab2(0)
max = tab2(0)
For j = 0 To taille - 1
If tab2(j) > max Then
max = tab2(j)
End If
If tab2(j) < min Then
min = tab2(j)
End If
Next
h = max - min
scale1 = (200 / h) / 2
Timer1.Enabled = True
End If
End With
End Sub
Private Sub Sauvegarder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sauvegarder.Click
Dim savedialog As New SaveFileDialog
With savedialog
.Filter = "Fichier Texte (*.txt) | *.txt"
.FilterIndex = 1
.CheckFileExists = False
.FileName = "Consultation de " & RichTextBox1.Text & " " & RichTextBox2.Text & " du " & DateTimePicker1.Value.Day & " " & DateTimePicker1.Value.Month & " " & DateTimePicker1.Value.Year
If .ShowDialog = DialogResult.OK Then
RichTextBox4.Text = " Nom : " & RichTextBox1.Text & vbCrLf & " Prénom : " & RichTextBox2.Text & vbCrLf & " Date de la consultation : " & DateTimePicker1.Value.Date & vbCrLf & " Interprétation du medecin : " & RichTextBox2.Text & vbCrLf
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter(.FileName, True)
file.WriteLine(RichTextBox4.Text)
file.Close()
End If
End With
End Sub
Private Sub sto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sto.Click
Timer1.Enabled = False
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = False
Timer1.Interval = 10
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'ecg
Dim coor As Integer
Dim abs As Integer = 0
Dim lig As Integer = 0
Dim b As New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim tab2(taille) As Double
coor = scale1 * -1 * tab2(lig) + 50
b.SetPixel(abs, coor, Color.GreenYellow)
abs = abs + 1
lig = lig + 10
PictureBox1.Image = b
If abs > 438 Then
abs = 0
End If
'fin ecg
End Sub
End Class |
Partager