As Single Dim px (100), p y (100) As Single 'used to store 100 points the abscissa and ordinate
Dim minx, maxx, miny, maxy, y 'drawing area coordinates set
Dim w, h, nw, num, N
Private Sub Form_Load ()
Pic. Cls
The outside of the line is drawn '
Me.=vbRed 'ForeColor line drawing the default color is red
Me. DrawWidth=3 'line width to 3
Me. FontSize=12 '12 point font words
Me. FontBold=True 'bold
Me. The Line (Pic) Left, Pic. Top + Pic. Height + 30) - (Pic. Left + Pic. Width, Pic. Top + Pic. Height + 30) 'painting lateral horizontal
Me. The Line (Pic) Left - 30, Pic. Top) - (Pic) Left - 30, Pic. Top + Pic. Height) 'painting lateral vertical lines
'drawing scale
For I=0 To 4
Me. The Line (Pic. Left - 120, Pic. Top + Pic. Height * I/4) - (Pic) Left, Pic. Top + Pic. Height * I/4)
Me. The Line (Pic) Left + Pic) Width * I/4, Pic. Top + Pic. Height) - (Pic) Left + Pic) Width * I/4, Pic. Top + Pic. Height + 120)
Me. CurrentX=Pic. Left - 1000
Me. CurrentY=Pic. Top + (Pic) Height * (4 - I)/4) + 15
Me. Print Format (I * 100/4, "00.00")
'Label2 (I). Left=Pic. Left - Label2 (I). The Width - 150
'Label2 (I). Top=Pic. Top + (Pic) Height * (4 - I)/4) + 15
Label1 (I). Left=Pic. Left + (Pic. Width * I/4) - Label1 (I). The Width/2
Label1 (I). Top=Pic. Top + Pic. Height + Label1 (I). The Height + 120
Next
Minx=0
Maxx=Pic. Width
Miny=0
Maxy=Pic. Height
Init
End Sub
Sub Init ()
Dim mW As Integer
Dim mH As Integer
'the gridding
12 For I=1 To 12 'painting line with
MW=Pic. Width * (I/12)
If I Mod 3=0 Then
Pic. DrawStyle=0 'solid line horizontal lines
The Else
Pic. DrawStyle=4 'or draw a dotted line
End the If
Pic. The Line (mW, 0) - (mW, Pic. Height) 'define the Line drawing
Next
For I=1 To 12 'draw vertical lines 12 with
MH=Pic. Height * (I/12)
If I Mod 3=0 Then
Pic. DrawStyle=0 'painting lines
The Else
Pic. DrawStyle=4 'draw a dotted line
End the If
Pic. The Line (0, mH) - (Pic. Width, mH) 'define the Line drawing
Next
End Sub
The Function GetNTime (ByVal mMs As Integer) As String 'time Function
Dim mH, mM, mS As String 'define the hours, minutes, seconds for String type
Dim mA As the String 'definition of the current time As a String type
Dim mT As Long Long 'define total number of seconds is a numeric
Dim tk 'one dimensional array variant
MA=Format (Now, "hh - mm - ss") 'current time
Tk=Split (mA, "-") 'mA, hours, minutes, seconds
MH=tk (0) 'hours assigned to mH
MM=tk (1) the 'minutes is assigned to the mM
MS=tk (2) 's assigned to mS
MT=mH * 3600 + + mMs (mM) * 60 + mS 'calculate all of the current number of seconds to
GetNTime=Format (mT \ 3600, "00") & amp; ":" & amp; Format (mT \ 60 Mod 60, "00") & amp; ":" & amp; Format (mT Mod 60, "00")
End the Function
Private Sub Timer1_Timer ()
Dim I
Label1 (0). The Caption=Format (Now, "hh: mm: ss") 'to the current time to lable1 (0)
For I=1 To 4 'in turn is assigned To the time after the lable ()
Label1 (I). The Caption=GetNTime (I * 5)
Next
End Sub
Private Sub Timer2_Timer ()
H=maxy - miny 'painting area highly
W=maxx - minx 'painting area width
Nw=w/100 'curve on the horizontal spacing of adjacent two
Num=100 'set a screen 100 points
Pic. Cls
The outside of the line is drawn '
Me.=vbRed 'ForeColor line drawing the default color is red
Me. DrawWidth=3 'line width to 3
Me. FontSize=12 '12 point font words
Me. FontBold=True 'bold
Me. The Line (Pic) Left, Pic. Top + Pic. Height + 30) - (Pic. Left + Pic. Width, Pic. Top + Pic. Height + 30) 'painting lateral horizontal
Me. The Line (Pic) Left - 30, Pic. Top) - (Pic) Left - 30, Pic. Top + Pic. Height) 'painting lateral vertical lines
'drawing scale
For I=0 To 4
Me. The Line (Pic. Left - 120, Pic. Top + Pic. Height * I/4) - (Pic) Left, Pic. Top + Pic. Height * I/4)
Me. The Line (Pic) Left + Pic) Width * I/4, Pic. Top + Pic. Height) - (Pic) Left + Pic) Width * I/4, Pic. Top + Pic. Height + 120)
Me. CurrentX=Pic. Left - 1000
Me. CurrentY=Pic. Top + (Pic) Height * (4 - I)/4) + 15
Me. Print Format (I * 100/4, "00.00")
'Label2 (I). Left=Pic. Left - Label2 (I). The Width - 150
'Label2 (I). Top=Pic. Top + (Pic) Height * (4 - I)/4) + 15
Label1 (I). Left=Pic. Left + (Pic. Width * I/4) - Label1 (I). The Width/2
Label1 (I). Top=Pic. Top + Pic. Height + Label1 (I). The Height + 120
Next
Minx=0
Maxx=Pic. Width
Miny=0
Maxy=Pic. Height
Init
If N & lt; Num Then 'is not 100 points, drawing has not yet right border, use the line method draw directly on the target picture box, need not translation
For I=N To N
X=minx + I * nw 'to the abscissa assignment
Y=miny + + Rnd * 0.8 * 0.1 * h h 'to ordinate assignment
P (I)=x
Py (I)=y
Next I
The Else
For I=0 To 97 'array filled with progressive forward will lost the first element
Py (I)=p y (I + 1)
P (I)=minx + I * nw
Next I
Px (98)=minx + 98 * nw
Py (98)=p y (99)
Py (99)=miny + + Rnd * 0.8 * 0.1 * h h 'last element array to store the latest value always
Px (99)=minx + 99 * nw
'get two points can draw after
If N & gt;=2 Then
Pic. DrawWidth=2
Pic. PSet (px (0), py (0))
For I=1 To N
Pic. The Line - (px (I - 1), x (I - 1)), vbRed
Next I
End the If
End the If
End Sub
Above is I change the program, the following is modeled on a sample, the program can draw graph
As Single Dim px (100), p y (100) As Single 'used to store 100 points the abscissa and ordinate
Dim minx, maxx, miny, maxy, y 'drawing area coordinates set
Dim w, h, nw, num, N
Private Sub Form_Load ()
'draw with VB method curve of temperature measurement, temperature range is 10 to 40 degrees Celsius to display
Picture1. Cls
Picture1. The ScaleMode=0 'user-defined
Picture1. Scale (0, Picture1. Height) - (Picture1. Width, 0) 'drawing locale
Minx=0 + 10
Maxx=Picture1. Width - 10
Miny=0 + 10
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull