Reputation: 2174
Whether is it possible to draw ECG in VB6.0? As i am not that much familiar with VB any type of help will be appreciated.Please help me .thanks in advance.
Upvotes: 1
Views: 1034
Reputation: 24283
The simplest method to do this is to use a picture box with the AutoRedraw
property set to true and the ScaleMode
set to vbPixels
.
For each point, you calculate the Y value (dependant on the minimum and maximum allowable values). To make it scan, just increment the X value for each point you draw wrapping back to 0 when it gets to the width of the picture box (.ScaleWidth
).
You can use the picture box's .Line
method to blank the areas behind the current X point and the .PSet
method to draw the new point.
Dim X As Long
Dim LastValue As Long
Private Sub AddPoint(ByVal Value As Long)
'Clear the line behind (for 5 pixels forward)
Picture1.Line (X, 0)-(X + 5, Picture1.ScaleHeight), vbBlack, BF
'Draw the new point and the line from the previous point
Picture1.Line (X - 1, LastValue)-(X, Value), vbGreen
Picture1.PSet (X, Value), vbGreen
'Update the last value so we can draw the line between them
LastValue = Value
'Increment the X value for the next point
X = X + 1
If X = Picture1.ScaleWidth Then X = 0
End Sub
A better method is to use an off screen picture that you update using a similar method and just update the picturebox when needed.
Upvotes: 3