VB6.0で心電図を描くことは可能ですか?私はVBにあまり詳しくないので、どんな種類の助けもいただければ幸いです。よろしくお願いします。
1 に答える
3
これを行う最も簡単な方法は、AutoRedraw
プロパティを true に設定し、 を に設定しScaleMode
てピクチャ ボックスを使用することvbPixels
です。
各ポイントについて、Y 値を計算します (最小許容値と最大許容値に依存します)。スキャンするには、描画する各ポイントの X 値をインクリメントして、画像ボックスの幅に達したら 0 に戻します ( .ScaleWidth
)。
ピクチャ ボックスの.Line
メソッドを使用して、現在の X ポイントの背後の領域を空白にし、メソッドを使用.PSet
して新しいポイントを描画できます。
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
より良い方法は、同様の方法を使用して更新するオフスクリーン画像を使用し、必要に応じて画像ボックスを更新することです。
于 2012-09-18T16:01:36.823 に答える