Public Class Form1 Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint '背景を黒にする e.Graphics.Clear(Color.Black) '学校数学の座標系に変換。(さらに、横方向を8倍に拡大。このくらいしないと2次関数がとんがりすぎる) e.Graphics.MultiplyTransform(New Drawing2D.Matrix(8, 0, 0, -1, Me.ClientRectangle.Width \ 2, Me.ClientRectangle.Height \ 2)) '▼座標系のX軸とY軸の描画 'X軸 e.Graphics.DrawLine(Pens.DarkGray, 0, Me.ClientRectangle.Height, 0, -Me.ClientRectangle.Height) 'Y軸 e.Graphics.DrawLine(Pens.DarkGray, Me.ClientRectangle.Width, 0, -Me.ClientRectangle.Width, 0) '▼ y = x ^ 2 の関数の点を計算 Dim points() As Point ReDim points(Me.ClientRectangle.Width) For i = 0 To Me.ClientRectangle.Width Dim x As Integer Dim y As Integer x = i - (Me.ClientRectangle.Width \ 2) y = x ^ 2 points(i) = New Point(x, y) 'あくまで「点」で描画するなら、この下の行のコメントをはずし、DrawLinesの行をコメントにする。 'e.Graphics.FillRectangle(Brushes.Red, x, y, 1, 1) Next '▼点を線で結ぶ e.Graphics.DrawLines(Pens.Blue, points) End Sub Private Sub Form1_Resize(sender As System.Object, e As System.EventArgs) Handles MyBase.Resize Me.Invalidate() End Sub End Class