注册 登录
编程论坛 VB.NET论坛

【请教】无效参数问题

timeme100 发布于 2010-09-15 18:51, 525 次点击
在PictureBox绘图中显示了无效参数的问题,g.DrawLines(mpen, Points) 部分是出错的地方,请问怎样解决?
谢谢
程序代码:
[color=#0000FF]Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        


    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim y As Single
        Dim x As Single
        Dim g As Graphics = Me.PictureBox1.CreateGraphics
        Dim mpen As New Pen(Color.Red)
        Dim array As New List(Of PointF)
        Dim Points As PointF()
        'g.Clear(Color.Black)

        Randomize()
        y = 200 * Rnd()
        array.Add(New PointF(x, y))
        Points = array.ToArray
        g.DrawLines(mpen, Points)
        x = x + 1
    End Sub
End Class

[/color]




[ 本帖最后由 timeme100 于 2010-9-15 18:54 编辑 ]
0 回复
1