a.Clear(Me.BackColor)在程序中起什么作用?
有和没有运行前后,我发现没什么变化
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click Dim a As Graphics Dim mypen As Pen Dim mypoints() As PointF Dim i As Integer Dim mycount As Integer
mypen = New Pen(System.Drawing.Color.Red, 3)
mycount = Me.Width / 3 ReDim mypoints(mycount)
For i = 1 To mycount mypoints(i).X = i * 10 mypoints(i).Y = -1 * (Sin(i)) ^ 2 * Me.Height Next
a = Me.CreateGraphics a.Clear(Me.BackColor) a.ScaleTransform(1, -1) a.DrawCurve(mypen, mypoints)
a.Dispose() mypen.Dispose() End Sub