Senin, 08 Agustus 2011

Calculator NE


nah yang satu ini adalah aplikasi untuk menghitung luas,keliling lingkaran dan persegi panjang
jika anda ingin membuatnya ikuti langkah berikut
1. Buatlah 2 form
2. untuk form 1
3.  Buat 5 label ( form 1)
-label 1 diganti jari - jari
-label 2 diganti luas
-label 3 diganti keliling
-label 4 diganti www.nugrohosentoso.blogspot.com (tulisan yg brwarna merah boleh di ganti)
-label 5 diganti NulaElieT (tulisan warna merah boleh di ganti)
4. Buat 3 text
5. Buat 3 command buttom (cmd)
-cmd1 di ganti luas persegi
-cmd2 di ganti reset
-cmd3 di ganti hasil
6. Buat 2 timer (timer 1 intervalnya 20 dan timer 2 intervalnya 50)
untuk form 1 masukan code ini

Dim blue, green, red As Integer
Const phi As Double = 22 / 7
Dim hasil As Double

Private Sub About_Click(Index As Integer)
MsgBox "calculator menghitung luas,keliling lingkaran dan persegi", vbInformation
MsgBox "By : Nugroho Sentoso (www.nugrohosentoso.blogspot)", vbInformation

End Sub

Private Sub Command1_Click()
Form2.Show
End Sub

Private Sub Command2_Click()
Text1.Text = Clear
Text2.Text = Clear
Text3.Text = Clear
End Sub




Private Sub Command3_Click()
hasil = phi * (Text1.Text * Text1.Text)
Text2.Text = hasil
hasil = 2 * phi * (Text1.Text)
Text3.Text = hasil

End Sub



Private Sub Exit_Click(Index As Integer)
MsgBox " TerimaKasih Anda telah mengunakan Aplikasi ini", vbInformation
End
End Sub

Private Sub Timer1_Timer()
Label4.Left = Label4.Left - 25
If Label4.Left <= -Label4.Left Then
Label4.Left = NulaEliet.Width
End If
End Sub

Private Sub Timer2_Timer()

If blue <= 255 Then
    blue = blue + 50
Else
    blue = 0
    green = green + 50
End If

If green >= 255 Then
    green = 0
    red = red + 50
End If

If red >= 255 Then
    red = 0
End If
Label1.ForeColor = Int(RGB(red, green, blue))
Label1.Refresh
Label2.ForeColor = Int(RGB(red, green, blue))
Label2.Refresh
Label3.ForeColor = Int(RGB(red, green, blue))
Label3.Refresh
Label4.ForeColor = Int(RGB(red, green, blue))
Label4.Refresh
Label5.ForeColor = Int(RGB(red, green, blue))
Label5.Refresh
End Sub


untuk form 2 sama seperti form 1 cuma ada yang berbeda source codenya

1. buat 5 label
-label 1 captionnya diganti sisi1
-label 2 captionnya diganti sisi2
-label 3 captionnya diganti hasil
-label 4 captionnya diganti www.nugrohosentoso.blogspot.com (tulisan warna merah boleh di ganti)
-label 5 captionnya diganti NulaElieT (tulisan warna merah boleh di ganti)
2. 3 text
-text1 kosongkan saja captionnya
-text2 kosongkan saja captionnya
-text3 kosongkan saja captionnya
3. buat 3 command buttom (cmd)
-cmd1 captionnya diganti reset
-cmd2 captionnya diganti luas
-cmd3 captionnya diganti keliling
4. buat 2 timer (interval timer1 diganti 50 dan timer2 diganti 20)
nah sekarang tinggal masukan source code ini "sudah di rancang belum programnya "


Dim blue, green, red As Integer

Private Sub Command1_Click()
Text1.Text = Clear
Text2.Text = Clear
Text3.Text = Clear
End Sub

Private Sub Command2_Click()
hasilluas = Val(Text1.Text) * Val(Text2.Text)
Text3.Text = hasilluas
End Sub

Private Sub Command3_Click()
hasilkeliling = 2 * Val((Text1.Text) + Val(Text2.Text))
Text3.Text = hasilkeliling
End Sub



Private Sub Timer1_Timer()
If blue <= 255 Then
    blue = blue + 50
Else
    blue = 0
    green = green + 50
End If

If green >= 255 Then
    green = 0
    red = red + 50
End If

If red >= 255 Then
    red = 0
End If
Label1.ForeColor = Int(RGB(red, green, blue))
Label1.Refresh
label2.ForeColor = Int(RGB(red, green, blue))
label2.Refresh
label3.ForeColor = Int(RGB(red, green, blue))
label3.Refresh
Label4.ForeColor = Int(RGB(red, green, blue))
Label4.Refresh
Label5.ForeColor = Int(RGB(red, green, blue))
Label5.Refresh
End Sub


Private Sub Timer2_Timer()
label3.Left = label3.Left - 15
    If label3.Left <= -label3.Left Then
        label3.Left = Form2.Width
    End If
End Sub

ni gambarnya 


kalau mau download file source codenya 
kalau mau download setup nya 
jangan lupa klo bisa likein ya.... by : nugroho sentoso

Tidak ada komentar:

Posting Komentar