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
- myGraphics.Clear(Me.BackColor)
- myGraphics.DrawRectangle(myPen0, x1, y1, 499, 499)
- a = 150
- For id = 0 To 500 Step 50
- myGraphics.DrawLine(myPen1, id, 0, id, 500)
- myGraphics.DrawLine(myPen1, 0, id, 500, id)
- Next
- myGraphics.TranslateTransform(500 / 2, 500 / 2)
- If TextBox1.Text >= 250 Then
- MsgBox("The Largest Radius should be less than 500")
- TextBox1.Clear()
- Return
- End If
- For a = TextBox1.Text / 5 To TextBox1.Text Step TextBox1.Text / 5
- 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
- Next
- 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
- Label1.Left = PictureBox1.Width + 50 : Label1.Top = 140
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement