Advertisement
Guest User

exercise 8

a guest
Jun 14th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  3.         Me.AutoSize = True : Me.Text = "Graph by 40602154"
  4.         PictureBox1.Top = 0 : PictureBox1.Left = 0
  5.         PictureBox1.Width = 500 : PictureBox1.Height = 500
  6.         Button1.Text = "Draw" : Button1.Font = New Font("Courier", 20)
  7.         Button1.Width = 100 : Button1.Height = 50
  8.         Button1.Top = 10 : Button1.Left = PictureBox1.Width + 50
  9.     End Sub
  10.     Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  11.         Dim myGraph As Graphics = PictureBox1.CreateGraphics
  12.         Dim myPen1, myPen2, myPen3 As Pen
  13.         Dim id, ang, bigR, x1, y1 As Single
  14.         myPen1 = New Pen(Color.Blue, 5) : myGraph.DrawRectangle(myPen1, 0, 0, 500, 500)
  15.         myPen2 = New Pen(Color.Gray, 1)
  16.         myGraph.DrawLine(myPen2, 0, 250, 500, 250)
  17.         myGraph.DrawLine(myPen2, 250, 0, 250, 5000)
  18.         myGraph.TranslateTransform(250, 250)
  19.         myPen3 = New Pen(Color.DarkMagenta, 3)
  20.         bigR = 200
  21.         For id = 0 To 360 Step 4
  22.             ang = id * Math.PI / 180
  23.             x1 = bigR * Math.Cos(ang) : y1 = bigR * Math.Sin(ang)
  24.             myGraph.DrawLine(myPen3, x1, y1, 1, 1)
  25.         Next
  26.     End Sub
  27.  
  28. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement