Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
- Dim myGraphics As Graphics = PictureBox1.CreateGraphics
- Dim myPen0 As New Pen(Color.Blue, 5)
- Dim myPen1 As New Pen(Color.Gray, 0.5) : Dim myPen2 As New Pen(Color.Red, 2)
- Dim a, id As Integer
- Dim x1, y1, angle As Single
- Dim R As Single
- myGraphics.Clear(Me.BackColor)
- myGraphics.DrawRectangle(myPen0, x1, y1, 499, 499)
- a = 150
- myGraphics.TranslateTransform(500 / 2, 500 / 2)
- For angle = 0 To 2 * Math.PI Step 0.01
- R = 75 * (1 - 2 * Math.Sin(3 * angle))
- 'x1 = angle * Math.Cos(R) * 10
- 'y1 = angle * Math.Sin(R) * 10
- x1 = R * Math.Cos(angle) * 1
- y1 = R * Math.Sin(angle) * 1
- myGraphics.DrawRectangle(myPen2, x1, y1, 1, 1)
- Next
- 'For id = 0 To 360 Step 2
- 'angle = id * Math.PI / 180
- 'x1 = a * Math.Cos(angle) : y1 = a * Math.Sin(angle)
- 'myGraphics.DrawRectangle(myPen2, x1, y1, 1, 1)
- 'Next id
- myGraphics.Dispose()
- End Sub
- Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
- Me.AutoSize = True
- PictureBox1.Top = 0 : PictureBox1.Left = 0
- PictureBox1.Width = 500 : PictureBox1.Height = 500
- Button1.Left = PictureBox1.Width + 50 : Button1.Top = 150
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement