Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.39 KB | None | 0 0
  1. Public Class Form1
  2.     'im not going to quote out this source too much you should be able to look at this and understand
  3.     'whats going on if you suck at math dont read any further lol if you dont know what cosin and sin are
  4.     'you might get away copy pasting this but never understanding it if you do understand math
  5.     'what sin is and cosin are then this should make sense pretty quickly
  6.     'basicly i wrote this up in about 20 minutes but here is a rough outline of whats going on
  7.     '
  8.  
  9.     '  ' _____            _   _         _              _       _  '  '
  10.     '  '|_   _|          | | | |       | |            (_)     | | '  '
  11.     '  '  | |   ___    __| | | |_ _   _| |_  ___  _ __ _  __ _| | '  '
  12.     '  '  | |  / __|  / _` | | __| | | | __|/ _ \| '__| |/ _` | | '  '
  13.     '  ' _| |__\__ \_| (_| | | |_| |_| | |_| (_) | |  | | (_| | | '  '
  14.     '  ' \___(_)___(_)\__,_|  \__|\__,_|\__|\___/|_|  |_|\__,_|_| '  '
  15.  
  16.     'DECLARATIONS
  17.  
  18.     'this is your center point - imagine putting your pencil down in a compass
  19.     Public Center As New Point(120, 120)
  20.     'timers tick value open timer 1 - tick speed and angle will make your object move faster
  21.     'your angle for a circle is what ?  360
  22.     Dim tick As Integer
  23.     'distance from your center point 1 inch radius makes a 2 inch circle if that helps, or you didnt go to school
  24.     Public radius As Integer = 190
  25.     'basicly the step value of
  26.     Dim angleval As Integer
  27.     'do you remember rise over run from school ? basicaly im going to break this down as simple as i can
  28.     'basicly the sine of the angle gives you your rise
  29.     Dim sineval As Integer
  30.     'and your cosine gives you your run
  31.     Dim cosineval As Integer
  32.     'the angle that your sine and cosine are to be found for
  33.     Private Angle As Integer = 0
  34.  
  35.  
  36.     'form load and declarition of default values incase a skid just hits start lol
  37.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  38.         MsgBox("Hope this helps you make a more user interactive experience for your users")
  39.         MsgBox("credits i.s.d imports system.drawing on hf, if you use this you dont need to credit me")
  40.         MsgBox("just say thanks in my thread")
  41.         angleval = 1
  42.         cosineval = 180
  43.         sineval = 180
  44.  
  45.         tick = 1
  46.         radius = 100
  47.         Center = New Point(100, 100)
  48.     End Sub
  49.     'timer/mathmatics per tick event
  50.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  51.         Try
  52.             Timer1.Interval = tick
  53.         Catch
  54.         End Try
  55.         Dim x As Integer = CInt(Math.Round(radius * Math.Cos(Angle * Math.PI / cosineval)))
  56.         Dim y As Integer = CInt(Math.Round(radius * Math.Sin(Angle * Math.PI / sineval)))
  57.         If CheckBox1.Checked = True Then
  58.             PictureBox1.Location = New Point(x + Center.X, y + Center.Y)
  59.         Else
  60.         End If
  61.         If CheckBox2.Checked Then
  62.             Button4.Location = New Point(x + Center.X, y + Center.Y)
  63.             Button5.Location = New Point(x + Center.X, y + Center.Y)
  64.             Button6.Location = New Point(x + Center.X, y + Center.Y)
  65.         End If
  66.         Try
  67.             angleval = DomainUpDown2.SelectedItem.ToString
  68.         Catch
  69.             angleval = 1
  70.         End Try
  71.         Angle += angleval
  72.         If Angle = 360 Then
  73.             Angle = 0
  74.         End If
  75.     End Sub
  76.     'start button
  77.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  78.         Timer1.Start()
  79.     End Sub
  80.     'stop button
  81.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  82.         Timer1.Stop()
  83.     End Sub
  84.     'set button
  85.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  86.         Try
  87.             angleval = DomainUpDown2.Text.ToString
  88.         Catch
  89.             MsgBox("you forgot angle its ok im a catch statement just fix it plox")
  90.         End Try
  91.         cosineval = TextBox2.Text.ToString
  92.         sineval = TextBox1.Text.ToString
  93.         tick = TextBox3.Text.ToString
  94.         Dim x1 As Integer
  95.         Dim y1 As Integer
  96.         x1 = TextBox4.Text.ToString
  97.         y1 = TextBox6.Text.ToString
  98.         Center = New Point(x1, y1)
  99.         radius = TextBox5.Text.ToString
  100.     End Sub
  101.  
  102.  
  103.  
  104. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement