tentu saja dengan menggunakan software VB6. apabila anda belum mempunyai VB6
silahkan download VB6 DISINI dulu ya.
langsung saja, mari pertama mulai dengan membuat code seperti ini
Option Explicit
DefLng A-Z
Private AlreadyClicked As Boolean
Private Centre_X As Single, Centre_Y As Single
Private Mouse_X As Single, Mouse_Y As Single
Private Sub Form_Click()
' ==================================================
' klik yang pertama : hanya menyimpan titik lokasi yang ditandai titik
' ==================================================
If Not AlreadyClicked Then
Centre_X = Mouse_X
Centre_Y = Mouse_Y
'Me.PSet (Centre_X, Centre_Y), vbGreen
Me.Line (Centre_X, Centre_Y - 40)-(Centre_X, Centre_Y + 40), vbBlue
Me.Line (Centre_X - 40, Centre_Y)-(Centre_X + 40, Centre_Y), vbBlue
AlreadyClicked = True
Exit Sub
End If
' ===========================================================
' klik yang kedua - menggambar lingkaran berdasarkan jari-jarinya
' ===========================================================
AlreadyClicked = False
' A) kalkulasi panjang antara dua titik yang di klik.
Dim Radius As Single
Dim Horizontal As Single, Vertical As Single
Horizontal = Centre_X - Mouse_X
Vertical = Centre_Y - Mouse_Y
Radius = Sqr(Horizontal * Horizontal + Vertical * Vertical)
' B) menggambar lingkaran.
Dim I As Single
For I = 0 To 6.4 Step 0.1
If I = 0 Then
Me.PSet (Centre_X + Sin(I) * Radius, Centre_Y + Cos(I) * Radius), vbRed
Else
Me.Line -(Centre_X + Sin(I) * Radius, Centre_Y + Cos(I) * Radius), vbRed
End If
Next
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
' jika mouse di klik di luar area, maka hanya menyimpan record yang terakhir.
Mouse_X = X: Mouse_Y = Y
End Sub
Sekian Tutorial kali ini, apabila kalian ingin mendownload source code beserta tutorialnya, silahkan download DISINI
0 comments:
Post a Comment
https://www.instagram.com/endskuulzyr027st.blogspot.com_/