首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

请高手帮小弟我看看这段代码

2012-04-19 
请高手帮我看看这段代码VB codeOption ExplicitDim DataFromCom As Integer 从串口读过来的实时值Dim Dat

请高手帮我看看这段代码

VB code
Option ExplicitDim DataFromCom As Integer '从串口读过来的实时值Dim DataFromComLast As Integer '上次的串口值Dim TimeCount As IntegerPrivate ap() As String '窗体收放比例数组Private Sub Form_Load()PicScale Pic '调整图像框的坐标系PicMidleLine Pic '在图像框中画一条中线End SubPrivate Sub PicScale(picX As PictureBox) '调整图像框的坐标系Pic.Scale (0, 1000)-(1000, -1000)End SubPrivate Sub PicMidleLine(picX As PictureBox) '在图像框中画一条中线picX.Line (0, 0)-(1000, 0), vbGreen '画出中线End SubPrivate Sub DrawRealLine(picX As PictureBox, TimeCountX As Integer, DataFromComX As Integer, DataFromComLastX As Integer)If TimeCountX - 1 > 0 ThenpicX.Line ((TimeCountX - 1) * 10, DataFromComLastX)-(TimeCountX * 10, DataFromComX), vbWhiteEnd IfEnd SubPrivate Sub Timer1_Timer()DataFromComLast = DataFromComRandomizeDataFromCom = 1000 * RndTimeCount = TimeCount + 1DrawRealLine Pic, TimeCount, DataFromCom, DataFromComLast '画出实时的曲线End SubPublic Sub ai()        '窗体的收放Dim i As IntegerOn Error Resume NextIf Controls.Count > 0 Then    '如果窗体中包括菜单,这时程序将出错    '解决办法:在代码前加"On Error Resume Next    For i = 0 To Controls.Count - 1      With ap(i)        .wp = Me.Controls(i).Width / Me.ScaleWidth        .hp = Me.Controls(i).Height / Me.ScaleHeight        .lp = Me.Controls(i).Left / Me.ScaleWidth        .tp = Me.Controls(i).Top / Me.ScaleHeight      End With    Next iEnd IfEnd Sub

在picture box中绘图,想让图线到边界的时候控件自动变化继续画线。我是新手,请大家帮忙

[解决办法]
这个简单点点说就是动态曲线绘制的问题。
前几天不是给了个例子给你吗?你可以借鉴去思想来设计啊?
[解决办法]
探讨谢谢,有很大收获。但是我想做一个到达边框时不是把原来的曲线删除而是希望坐标向左移动以使曲线继续向右绘制
谢谢

热点排行