![]() |
#2
lowxiong2013-03-05 22:15
Private Sub MSComm1_OnComm()
Dim BytReceived() As Byte Dim strBuff As Variant Select Case Case 2 MSComm1.InputLen = 0 strBuff = MSComm1.Input BytReceived() = strBuff Dim i As Long For i = 0 To UBound(BytReceived) Debug.Print BytReceived(i) Next If i <= 2 Then Text2 = BytReceived(0) BytReceived(0) = 0 Else tongyi = BytReceived(0) BytReceived(0) = 0 fandui = BytReceived(2) BytReceived(2) = 0 qiquan = BytReceived(4) BytReceived(4) = 0 End If End Select '绘制直方图 'CurrentX = 2 + 2: CurrentY = Text1.Text '找到绘制“赞同”直方图的起始位置 Line (6240 + 940, 4560 - 30)-(6240 + 1880, 4560 - 10 * 360), me.backcolor, BF '清除上次同意的直方图 Line (6240 + 940, 4560 - 30)-(6240 + 1880, 4560 - tongyi * 360), vbGreen, BF '绘制“赞同”直方图 CurrentX = 6240 + 1410: CurrentY = 4560 - tongyi * 360 - 200: Print tongyi Line (6240 + 2820, 4560 - 30)-(6240 + 3760, 4560 - 10 * 360), me.backcolor, BF '清除上次反对的直方图 Line (6240 + 2820, 4560 - 30)-(6240 + 3760, 4560 - fandui * 360), vbYellow, BF '绘制“反对”直方图 CurrentX = 6240 + 3290: CurrentY = 4560 - fandui * 360 - 200: Print fandui Line (6240 + 4700, 4560 - 30)-(6240 + 5640, 4560 - qiquan * 360), me.backcolor, BF '清除上次弃权的直方图 Line (6240 + 4700, 4560 - 30)-(6240 + 5640, 4560 - qiquan * 360), vbRed, BF '绘制“弃权”直方图 CurrentX = 6240 + 5170: CurrentY = 4560 - qiquan * 360 - 200: Print qiquan End Sub |
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录

Private Sub MSComm1_OnComm()
Dim BytReceived() As Byte
Dim strBuff As Variant
Select Case Case 2
MSComm1.InputLen = 0
strBuff = MSComm1.Input
BytReceived() = strBuff
Dim i As Long
For i = 0 To UBound(BytReceived)
Debug.Print BytReceived(i)
Next
If i <= 2 Then
Text2 = BytReceived(0)
BytReceived(0) = 0
Else
tongyi = BytReceived(0)
BytReceived(0) = 0
fandui = BytReceived(2)
BytReceived(2) = 0
qiquan = BytReceived(4)
BytReceived(4) = 0
End If
End Select
'绘制直方图
'CurrentX = 2 + 2: CurrentY = Text1.Text '找到绘制“赞同”直方图的起始位置
Line (6240 + 940, 4560 - 30)-(6240 + 1880, 4560 - tongyi * 360), vbGreen, BF '绘制“赞同”直方图
CurrentX = 6240 + 1410: CurrentY = 4560 - tongyi * 360 - 200: Print tongyi
Line (6240 + 2820, 4560 - 30)-(6240 + 3760, 4560 - fandui * 360), vbYellow, BF '绘制“反对”直方图
CurrentX = 6240 + 3290: CurrentY = 4560 - fandui * 360 - 200: Print fandui
Line (6240 + 4700, 4560 - 30)-(6240 + 5640, 4560 - qiquan * 360), vbRed, BF '绘制“弃权”直方图
CurrentX = 6240 + 5170: CurrentY = 4560 - qiquan * 360 - 200: Print qiquan
End Sub
Dim BytReceived() As Byte
Dim strBuff As Variant
Select Case Case 2
MSComm1.InputLen = 0
strBuff = MSComm1.Input
BytReceived() = strBuff
Dim i As Long
For i = 0 To UBound(BytReceived)
Debug.Print BytReceived(i)
Next
If i <= 2 Then
Text2 = BytReceived(0)
BytReceived(0) = 0
Else
tongyi = BytReceived(0)
BytReceived(0) = 0
fandui = BytReceived(2)
BytReceived(2) = 0
qiquan = BytReceived(4)
BytReceived(4) = 0
End If
End Select
'绘制直方图
'CurrentX = 2 + 2: CurrentY = Text1.Text '找到绘制“赞同”直方图的起始位置
Line (6240 + 940, 4560 - 30)-(6240 + 1880, 4560 - tongyi * 360), vbGreen, BF '绘制“赞同”直方图
CurrentX = 6240 + 1410: CurrentY = 4560 - tongyi * 360 - 200: Print tongyi
Line (6240 + 2820, 4560 - 30)-(6240 + 3760, 4560 - fandui * 360), vbYellow, BF '绘制“反对”直方图
CurrentX = 6240 + 3290: CurrentY = 4560 - fandui * 360 - 200: Print fandui
Line (6240 + 4700, 4560 - 30)-(6240 + 5640, 4560 - qiquan * 360), vbRed, BF '绘制“弃权”直方图
CurrentX = 6240 + 5170: CurrentY = 4560 - qiquan * 360 - 200: Print qiquan
End Sub