Dim test As Boolean
Dim Anum As Integer
Dim Bnum As Integer
Private Sub cmd_end_Click()
MSComm1.PortOpen = False
End
End Sub
Private Sub Form_Load()
MSComm1.PortOpen = True
Me.Height = 5800
Me.Width = 8900
Me.AutoRedraw = True
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive
Dim instring As String
Dim m As Integer
Text1.Text = ""
For m = 1 To MSComm1.InBufferCount
instring = instring + MSComm1.Input
Next
Text1.Text = instring
If instring = "Y" Then
Anum = Anum + 1
agree.Text = Anum
Else
If instring = "N" Then
Bnum = Bnum + 1
oppose.Text = Bnum
End If
End If
End Select
End Sub
Private Sub next_Click()
Anum = 0
agree.Text = Anum
Num = 0
oppose.Text = Bnum
MSComm1.Output="A"
End Sub
Private Sub plot_Click()
Static S As Integer
Static Ts As Integer
Ts = Ts + 1
If test = True Then
S = Anum
Else: S = Bnum
End If
If Val(S) > 40 Or Val(S) < 0 Then
Ts = Ts - 1
MsgBox "数据有误"
Exit Sub
End If
Set newobj = Me.Controls.Add("vb.shape", "shape" & Ts)
With newobj
.Shape = 0
.FillStyle = 5
.Left = 11 + 13 * Ts
.Top = 42 - S * 2
.Height = S * 2
.Width = 1
End With
newobj.Visible = True
test = test + 1
End Sub