| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 524 人关注过本帖
标题:在VB中怎么清除上次的直方图?
只看楼主 加入收藏
wxl900306
Rank: 1
等 级:新手上路
帖 子:26
专家分:2
注 册:2012-3-14
结帖率:85.71%
收藏
已结贴  问题点数:20 回复次数:4 
在VB中怎么清除上次的直方图?
我用VB做一个表决系统,现在是可以接收到数据,但发送序列号时无法清除上次投票结果的内容,帮忙看看!!!谢了
图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册
程序代码:
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
搜索更多相关主题的帖子: 直方图 序列号 
2013-03-05 21:08
lowxiong
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:27
帖 子:653
专家分:3402
注 册:2008-5-7
收藏
得分:20 
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

2013-03-05 22:15
wxl900306
Rank: 1
等 级:新手上路
帖 子:26
专家分:2
注 册:2012-3-14
收藏
得分:0 
太感谢了,早上试了,成功了,谢了
2013-03-06 09:15
wxl900306
Rank: 1
等 级:新手上路
帖 子:26
专家分:2
注 册:2012-3-14
收藏
得分:0 
回复 2楼 lowxiong
还有一个问题,就是我们实验用的开发板上时,同意反对弃权这三个值都可以正常的采集到并显示出来,但是我改成了自己的板子,同意反对都可以成功的采集并显示,但弃权怎么都显示不出来,我想硬件这个问题可以排除的,因为我弃权=总人数-同意-反对,所以即使没有按下任何同意反对弃权按键,他返回上位机的应该都是弃权,但就是无法显示,这可能是上位机的问题吗?
同样在开发板上上位机程序没问题,但到我自己的板子上上位机仍然没有改变,所以我不知道那里有问题了。可以帮忙分析一下么
2013-03-06 09:21
wxl900306
Rank: 1
等 级:新手上路
帖 子:26
专家分:2
注 册:2012-3-14
收藏
得分:0 
回复 2楼 lowxiong
因为有关vb方面的知识我只看了一个星期,没有过多的研究,我怀疑是不是这里的问题呢,      
        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
2013-03-06 09:23
快速回复:在VB中怎么清除上次的直方图?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028448 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved