VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Create a dynamically scrolling graph in Visual Basic. Creates a graph as data is generated in real-

MSKB#Q183333  (1 Submission)   Graphics   Visual Basic 5.0   Unknown Difficulty   Fri 16th July 1999   Mon 8th February 2021

Create a dynamically scrolling graph in Visual Basic. Creates a graph as data is generated in real-time, such as in a monitoring program.

API Declarations


Private Const PS_SOLID = 0

Private Declare Function CreateCompatibleDC Lib "gdi32" _
(ByVal hdc As Long) As Long

Private Declare Function CreateCompatibleBitmap Lib "gdi32" _
(ByVal hdc As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long) As Long

Private Declare Function SelectObject Lib "gdi32" _
(ByVal hdc As Long, _
ByVal hObject As Long) As Long

Private Declare Function CreatePen Lib "gdi32" _
(ByVal nPenStyle As Long, _
ByVal nWidth As Long, _
ByVal crColor As Long) As Long

Private Declare Function LineTo Lib "gdi32" _
(ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long) As Long

Private Declare Function MoveToEx Lib "gdi32" _
(ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal lpPoint As Long) As Long

Private Declare Function BitBlt Lib "gdi32" _
(ByVal hDestDC As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long) As Long

Private Const pWidth = 250 ' Width of picture box in pixels.
Private Const pHeight = 150 ' Height of picture box in pixels.
Private Const pGrid = 25 ' Distance between grid lines.
Private Const tInterval = 100 ' Interval between timer samplings
' in milliseconds.
Private Const pHeightHalf = pHeight \ 2
Dim counter As Long ' Number of data points logged so far. Used to
' sync grid.
Dim oldY As Long ' Contains the previous y coordinate.
Dim hDCh As Long, hPenB As Long, hPenC As Long

Rate Create a dynamically scrolling graph in Visual Basic. Creates a graph as data is generated in real- (1(1 Vote))
Create a dynamically scrolling graph in Visual Basic. Creates a graph as data is generated in real-.bas

Create a dynamically scrolling graph in Visual Basic. Creates a graph as data is generated in real- Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters