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 myPen3 As New Pen(Color.Black, 2)
- Dim a, id As Integer
- Dim x1, y1, y2, angle As Single
- myGraphics.Clear(Me.BackColor)
- myGraphics.DrawRectangle(myPen0, x1, y1, 499, 499)
- myGraphics.DrawLine(myPen1, 50, 0, 50, 500)
- myGraphics.DrawLine(myPen1, 0, 250, 500, 250)
- a = 150
- myGraphics.TranslateTransform(50, 250)
- 'For id = 0 To 360 Step 2
- 'angle = id * Math.PI / 180
- 'x1 = a * Math.Cos(angle) : y1 = a * Math.Sin(angle)
- 'myGraphics.DrawLine(myPen2, 50, 100, 1, 1)
- 'Next id
- For x1 = -50 To 450 Step 1
- y1 = -1 * Math.Cos(x1 * 7 * Math.PI / 500) * 100
- y2 = -1 * Math.Sin(x1 * 7 * Math.PI / 500) * 100
- myGraphics.DrawRectangle(myPen2, x1, y1, 1, 1)
- myGraphics.DrawRectangle(myPen3, x1, y2, 1, 1)
- 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
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement