用VB.NET 畫線的程式碼 (VB.NET)

用VB.NET 畫線的程式碼 (VB.NET)


    Dim g As Graphics

    Dim p As New Pen(Color.Red)

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

        g = Me.creategraphics
 

    End Sub
 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        p.Color = Color.Blue


        g.DrawLine(p, 0, 100, 0, 200)
        g.DrawLine(p, 200, 10, 400, 10)

    End Sub
 


如有錯誤 歡迎指正