Deskrpsi
Untuk menampilkan gambar dua dimensi secara beberapa
warna.dan memperkenalkan gambar dua dimensi tersebut kepada anak anak di bawah
kima tahun.
Tujuan
Untuk menampilkan gambar dua dimensi
Sasaran
Anak di bawah lima tahun.
Flowchart
Tutorial
Pembuatan Form1
Kemudian masukkan listing berikut ini
Private Sub Form1_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
Timer2.Enabled = False
Me.Text = "Aplikasi Bangun Dua
Dimensi Warna"
End Sub
Keterangan:
Baris pertama untuk mengaktifkan timer1
Baris kedua untuk mengaktifkan timer2
Baris ketiga untuk mengubah nama form1
menjadi “Aplikasi Bangun Dua Dimensi Warna”
Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form2.Show()
Me.Hide()
End Sub
Keterangan:
Baris pertama untuk menampilkan form2
Baris kedua untuk menyembunyikan form
yang bersangkutan
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Close()
End Sub
Keterangan:
Fungsi tersebut untuk menutup jendela
aplikasi
Private Sub Timer1_Tick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Label1.Left <= -Label1.Width Then
Timer1.Enabled = False
Timer2.Enabled = True
Else : Label1.Left = Label1.Left - 15
End If
End Sub
Keterangan:
Fungsi ‘if’ tersebut untuk membuat
label1 kelihatan seperti berjalan ke kiri
Private Sub Timer2_Tick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If Label1.Left >= Width Then
Timer2.Enabled = False
Timer1.Enabled = True
Else : Label1.Left = Label1.Left + 15
End If
End Sub
Keterangan:
Fungsi
tersebut untuk membuat label1 kelihatan seperti berjalan ke kanan
Pembuatan Form2
Komponen toolbox yang dibutuhkan
Kemudian masukkan listing berikut
Kemudian
masukkan listing berikut:
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Bangun Dua
Dimensi"
Me.BackColor = Color.Coral
End Sub
Keterangan:
Baris 1 untuk mengubah
nama form menjadi “Bangun Dua Dimensi”
Baris 2 untuk mengubah
warna background menjadi coral
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
If ComboBox1.Text = "Segitiga"
And ComboBox2.Text = "Biru" Then PictureBox1.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Persegi"
And ComboBox2.Text = "Biru" Then PictureBox2.Visible = True Else
PictureBox1.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Lingkaran"
And ComboBox2.Text = "Biru" Then PictureBox3.Visible = True Else
PictureBox2.Visible = False And PictureBox1.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Lingkaran"
And ComboBox2.Text = "Hijau" Then PictureBox4.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox1.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Persegi"
And ComboBox2.Text = "Hijau" Then PictureBox5.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox1.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Segitiga"
And ComboBox2.Text = "Hijau" Then PictureBox6.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox1.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Lingkaran"
And ComboBox2.Text = "Kuning" Then PictureBox7.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox1.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Persegi"
And ComboBox2.Text = "Kuning" Then PictureBox8.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox1.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Segitiga"
And ComboBox2.Text = "Kuning" Then PictureBox9.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox1.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Segitiga"
And ComboBox2.Text = "Merah" Then PictureBox10.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox1.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Persegi"
And ComboBox2.Text = "Merah" Then PictureBox11.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox1.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Lingkaran"
And ComboBox2.Text = "Merah" Then PictureBox12.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox1.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Lingkaran"
And ComboBox2.Text = "Putih" Then PictureBox13.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And PictureBox6.Visible
= False And PictureBox7.Visible = False And PictureBox8.Visible = False And
PictureBox9.Visible = False And PictureBox10.Visible = False And
PictureBox11.Visible = False And PictureBox12.Visible = False And
PictureBox1.Visible = False And PictureBox14.Visible = False And
PictureBox15.Visible = False And PictureBox16.Visible = False And
PictureBox17.Visible = False And PictureBox18.Visible = False
If ComboBox1.Text = "Persegi"
And ComboBox2.Text = "Putih" Then PictureBox14.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox1.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Segitiga"
And ComboBox2.Text = "Putih" Then PictureBox15.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox1.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Lingkaran"
And ComboBox2.Text = "Hitam" Then PictureBox16.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And PictureBox8.Visible
= False And PictureBox9.Visible = False And PictureBox10.Visible = False And
PictureBox11.Visible = False And PictureBox12.Visible = False And
PictureBox13.Visible = False And PictureBox14.Visible = False And
PictureBox15.Visible = False And PictureBox1.Visible = False And
PictureBox17.Visible = False And PictureBox18.Visible = False
If ComboBox1.Text = "Persegi"
And ComboBox2.Text = "Hitam" Then PictureBox17.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox1.Visible = False And
PictureBox18.Visible = False
If ComboBox1.Text = "Segitiga"
And ComboBox2.Text = "Hitam" Then PictureBox18.Visible = True Else
PictureBox2.Visible = False And PictureBox3.Visible = False And
PictureBox4.Visible = False And PictureBox5.Visible = False And
PictureBox6.Visible = False And PictureBox7.Visible = False And
PictureBox8.Visible = False And PictureBox9.Visible = False And
PictureBox10.Visible = False And PictureBox11.Visible = False And
PictureBox12.Visible = False And PictureBox13.Visible = False And
PictureBox14.Visible = False And PictureBox15.Visible = False And
PictureBox16.Visible = False And PictureBox17.Visible = False And
PictureBox1.Visible = False
End Sub
Keterangan:
Fungsi ‘if’ baris
pertama untuk menampilkan segitiga biru
Fungsi ‘if’ baris kedua
untuk menampilkan persegi biru
Fungsi ‘if’ baris
ketiga untuk menampilkan lingkaran biru
Fungsi ‘if’ baris
keempat untuk menampilkan lingkaran hijau
Fungsi ‘if’ baris
kelima untuk menampilkan persegi hijau
Fungsi ‘if’ baris
keenam untuk menampilkan segitiga hijau
Fungsi ‘if’ baris
ketujuh untuk menampilkan lingkaran kuning
Fungsi ‘if’ baris
kedelapan untuk menampilkan persegi kuning
Fungsi ‘if’ baris
kesembilan untuk menampilkan segitiga kuning
Fungsi ‘if’ baris
kesepuluh untuk menampilkan segitiga merah
Fungsi ‘if’ baris
kesebelas untuk menampilkan persegi merah
Fungsi ‘if’ baris
keduabelas untuk menampilkan lingkaran merah
Fungsi ‘if’ baris
ketigabelas untuk menampilkan lingkaran putih
Fungsi ‘if’ baris
keempatbelas untuk menampilkan persegi putih
Fungsi ‘if’ baris
kelimabelas untuk menampilkan segitiga putih
Fungsi ‘if’ baris
keenambelas untuk menampilkan lingkaran hitam
Fungsi ‘if’ baris
ketujuhbelas untuk menampilkan persegi hitam
Fungsi ‘if’ baris
kedelapanbelas untuk menampilkan segitiga hitam
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
ComboBox1.Text = ""
ComboBox2.Text = ""
PictureBox18.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = False
PictureBox4.Visible = False
PictureBox5.Visible = False
PictureBox6.Visible = False
PictureBox7.Visible = False
PictureBox8.Visible = False
PictureBox9.Visible = False
PictureBox10.Visible = False
PictureBox11.Visible = False
PictureBox12.Visible = False
PictureBox13.Visible = False
PictureBox14.Visible = False
PictureBox15.Visible = False
PictureBox16.Visible = False
PictureBox17.Visible = False
PictureBox1.Visible = False
End Sub
Keterangan:
Baris pertama untuk
mengembalikkan combobox1 ke posisi kosong
Baris kedua untuk
mengembalikkan combobox2 ke posisi kosong
Baris ketiga sampai ke-21
untuk mengembalikan picturebox ke posisi tidak terlihat
Private Sub Button7_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Me.Close()
End Sub
Keterangan:
Fungsi tersebut untuk menutup jendela
aplikasi tersebut