Public Class Form1 Private Const NumID = 4 Private Const MID = NumID - 1 Private CID(MID) As Color Private colorID() As Integer = {&HFF0000, &H8000, &HFFFF00, &HFF} Dim img As New Bitmap(500, 400) '300x300サイズのImage Private mu As Double, a As Double, b As Double, dm As Double Private Sub initData() CID(0) = Color.Red : CID(1) = Color.YellowGreen CID(2) = Color.White : CID(3) = Color.Yellow a = Val(TextBox1.Text) : b = Val(TextBox2.Text) : dm = Val(TextBox3.Text) mu = Val(TextBox4.Text) End Sub Private Sub drawView() Dim g As Graphics = Graphics.FromImage(img) : g.Clear(Color.Black) '描画クリア Dim X As Double, Y As Double, XN As Double, GM As Double Dim XP As Integer, YP As Integer, mX As Double mX = Math.Floor(mu * 1000 + 0.5) / 1000 : X = 0.1 : Y = 0 GM = mu * X + 2 * (1 - mu) * X * X / (1 + X * X) For i = 1 To 20000 XP = 250 - X * 10 + 0.5 : YP = 200 - Y * 10 + 0.5 If XP >= 0 And XP < img.Width And YP >= 0 And YP < img.Height Then img.SetPixel(XP, YP, CID(i Mod NumID)) End If XN = X : X = Y + a * (1 - b * Y * Y) * Y + GM GM = mu * X + 2 * (1 - mu) * X * X / (1 + X * X) Y = -XN + GM Next PictureBox1.Image = img : g.Dispose() 'リソースを解放する End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click initData() : Timer1.Enabled = True End Sub Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick If mu > 1 Then Timer1.Enabled = False Else drawView() : mu = mu + dm : TextBox4.Text = mu End If End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click Timer1.Enabled = False End Sub Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click initData() drawView() End Sub End Class