当前位置:编程学习 > VB >>

VB lineshape问题求助

我希望用lineshape进行实时作图,x轴是时间,y轴是温度。用timer每1秒产生时间触发,用lineshape产生line连接每个点。但是当时间到达最大值时,我希望缩小x轴,重新作图(rescale)。但是原来的线如论如何都无法删除。请教如何吧lineshape 或者 shapecotainer里的图形清空?代码如下:

    Private Sub Timer_plot_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer_plot.Tick
        Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
        Dim line1 As New Microsoft.VisualBasic.PowerPacks.LineShape
        ' Set the form as the parent of the ShapeContainer.
        canvas.Parent = PictureBox1 'RichTextBox1
        ' Set the ShapeContainer as the parent of the LineShape.
        line1.Parent = canvas
        ' Set the starting and ending coordinates for the line.
        ' Create pen.

            line1.StartPoint = New System.Drawing.Point(time1, y1 * ZoomY)
            line1.EndPoint = New System.Drawing.Point(time2, y2 * ZoomY)
                     
        End If
       
    End Sub 要是记录好了点,那清空一下再重画也可以嘛
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,