Younger brother now to be joined to a serial port in VB PC serial port to collect back the data to display the function of history curve, can send a sample program to me, or tell me how to do! Below is I saw on BBS, some do not understand, don't know which die picture controls, each master for help.
Real-time curve left shift function, defined in the module
Public 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
'create a class, as a real-time curve drawing
Option Explicit
Public pCurveNUM As Integer
Public pCurveName As String
Public pCurveMax As Double
Public pCurvemin As Double
Private pricCurve As PictureBox
Private priCurvePoint (6) As an Integer
Private priCurveData (6) As a Double
Private priDrawY0 (6) As a Double
Private priDrawY1 (6) As a Double
Private priDrawNMinute As Integer
Private priDrawTMinute As Integer
Private WithEvents priTimerDraw As Timer
Public Property Let ltDrawTimer (ByRef lTimer As timers)
The Set priTimerDraw=lTimer
End Property
Public Property Let ltGiveCurveData (ByVal lDataPoint As the Variant)
Dim I %
For I=1 To pCurveNUM
PriCurvePoint (I)=CInt (lDataPoint (I))
Next
End Property
Public Property Let ltGetPicture (ByRef lDrawPicBox As PictureBox)
The Set pricCurve=lDrawPicBox
End Property
Private Sub sDrawTheRealTimeCurve ()
Dim ypixels xpixels, I %
Dim ShowMode As Long, ii As Long, tm As String, hBmp As Long
PricCurve. DrawWidth=1
HBmp=pricCurve. HDC
ShowMode=& amp; HCC0020
Ii=BitBlt (hBmp, 0, 0, pricCurve ScaleWidth - 1, pricCurve. ScaleHeight - 1, hBmp, 1, 0, ShowMode)
Dim T As Integer
T=Minute (Now ())
PriDrawNMinute=T
If priDrawNMinute & gt; PriDrawTMinute Then
PricCurve. CurrentX=pricCurve. ScaleWidth - 19
PricCurve. CurrentY=pricCurve. ScaleHeight - 11
PricCurve. Print priDrawNMinute
End the If
PriDrawTMinute=priDrawNMinute
PricCurve. The ScaleMode=vbPixels
Ypixels=pricCurve. ScaleHeight - 1
Xpixels=pricCurve. ScaleWidth - 1
'For 1 to 6 curves
If pCurveNUM & gt; 6 the Or pCurveNUM & lt; 1 Then pCurveNUM=1
For I=1 To pCurveNUM
PriDrawY1 (I)=CInt (ypixels - (priCurveData (I) - pCurvemin)/(pCurveMax - pCurvemin) * ypixels)
If priDrawY1 (I)=priDrawY0 (I) Then priDrawY1 (I)=priDrawY1 (I) + 1
Next
PricCurve. Line (priDrawY0 xpixels - 1, (1) - (priDrawY1 xpixels - 1, (1)), vbRed
If pCurveNUM & gt; 1 Then pricCurve. Line (priDrawY0 xpixels - 1, (2)) - (priDrawY1 xpixels - 1, (2)), vbWhite
If pCurveNUM & gt; 2 Then pricCurve. Line (priDrawY0 xpixels - 1, (3) - (priDrawY1 xpixels - 1, (3)), vbGreen
'If pCurveNUM & gt; 3 Then pricCurve. Line (priDrawY0 xpixels - 1, (4) - (priDrawY1 xpixels - 1, (4)), spColor (3). The FillColor
'If pCurveNUM & gt; 4 Then pricCurve. Line (priDrawY0 xpixels - 1, (5) - (priDrawY1 xpixels - 1, (5)), spColor (4). The FillColor
'If pCurveNUM & gt; 5 Then pricCurve. Line (priDrawY0 xpixels - 1, (6)) - (priDrawY1 xpixels - 1, (6)), spColor (5). The FillColor
For I=1 To 6
PriDrawY0 (I)=priDrawY1 (I)
Next
End Sub
Public Sub clsInit ()
Dim I %
For I=1 To 6
PriDrawY0 (I)=pricCurve. Height
PriDrawY1 (I)=pricCurve. Height
Next
PriTimerDraw. Interval=1000
PriTimerDraw. Enabled=True
End Sub
Private Sub priTimerDraw_Timer ()
Dim I %
For I=1 To pCurveNUM
PriCurveData (I)=gRealTimeData (priCurvePoint (I))
Next
Call sDrawTheRealTimeCurve
End Sub
CodePudding user response:
Dim j As Integer
Dim As Integer I
Dim tem As the Variant
Dim CNT As Integer
Dim saved As Integer
Dim darwed As Integer
Dim csbuf (155) As the Variant
Dim zqlsbuf (155) As the Variant
Dim yqlsbuf (155) As the Variant
Dim zhlsbuf (155) As the Variant
Dim yhlsbuf (155) As the Variant
Dim hylbuf (155) As the Variant
Dim ZDJL (2) As the Variant
Dim CSTMP As the Variant
Dim ZCTMP As the Variant
Dim As a Integer
Dim As String b
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Private Sub Check2_Click () 'according to the actual collection current value curve
Picture1show 'display current curve chart
Picture1. DrawWidth=1
J=0
For I=0 To 900 Step 20
Picture1. Line (I, csbuf (j) * 10) - (I + 20, csbuf (j + 1) * 10), vbGreen
Sleep 1000
J=j + 1
Next I
End Sub
Private Sub Command2_Click (Index As an Integer)
MSComm1. The Output="FF001160000C4"
Sleep 300
MSComm1. The Output="FF00111FF"
Sleep 300
MSComm1. The Output="FF0011605DCF0"
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull