Kamis, 15 November 2012

TUTORIAL BANGUN DUA DIMENSI WARNA


Tambahankan Form , Label, ComboBox, Button, dan TextBox
Menambahkan Form : Klik New Project > Add > New Items >Windows Form
Menambahkan Label : Klik label di ToolBox > Ganti Text sesuati dengan nama yang di inginkan.
Menambahkan TextBox : Klik Textbox pada ToolBox.
Menambahkan ComboBox: Klik ComboBox pada TollBox
Menambahkan Button : Klik Button pada ToolBox

Masukkan listing berikut:



Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "LINGKARAN" And TextBox2.Text = "MERAH" Then OvalShape1.Show()
        If TextBox1.Text = "LINGKARAN" And TextBox2.Text = "KUNING" Then OvalShape2.Show()
        If TextBox1.Text = "LINGKARAN" And TextBox2.Text = "HIJAU" Then OvalShape3.Show()
        If TextBox1.Text = "PERSEGI" And TextBox2.Text = "MERAH" Then RectangleShape1.Show()
        If TextBox1.Text = "PERSEGI" And TextBox2.Text = "KUNING" Then RectangleShape2.Show()
        If TextBox1.Text = "PERSEGI" And TextBox2.Text = "HIJAU" Then RectangleShape3.Show()

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        ComboBox1.SelectedItem = Nothing
        ComboBox2.SelectedItem = Nothing
        OvalShape3.Hide()
        OvalShape2.Hide()
        OvalShape1.Hide()
        RectangleShape3.Hide()
        RectangleShape2.Hide()
        RectangleShape1.Hide()

    End Sub

 
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged
        If ComboBox1.Text = "LINGKARAN" Then TextBox1.Text = "LINGKARAN" Else TextBox1.Text = "PERSEGI"
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.TextChanged
        If ComboBox2.Text = "MERAH" Then TextBox2.Text = "MERAH"
        If ComboBox2.Text = "KUNING" Then TextBox2.Text = "KUNING"
        If ComboBox2.Text = "HIJAU" Then TextBox2.Text = "HIJAU"
    End Sub

    Private Sub OvalShape3_TEXTCHANGED(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Activated
        OvalShape3.Hide()
    End Sub
  Private Sub OvalShape2_TEXTCHANGED(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Activated
        OvalShape2.Hide()

    End Sub

    Private Sub OvalShape1_TEXTCHANGED(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Activated
        OvalShape1.Hide()

    End Sub

    Private Sub RectangleShape3_textchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Activated
        RectangleShape3.Hide()

    End Sub

    Private Sub RectangleShape2_textchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Activated
        RectangleShape2.Hide()

    End Sub

    Private Sub RectangleShape1_textchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Activated
        RectangleShape1.Hide()

    End Sub

End Class
Maka akan muncul tampilan seperti ini


















Berikut dijabarkan lebih detail
NO
KOMPOSISI
PROPERTIES
KETERANGAN
1
FORM1
NAME
FORM1


TEXT

2
LABEL 1
NAME
LABEL1


TEXT
BENTUK 2 DIMENSI
3
LABEL2
NAME
LABEL2


TEXT
BENTUK
4
LABEL3
NAME
LABEL3


TEXT
WARNA
5
LABEL4
NAME
LABEL4


TEXT
GAMBAR
6
COMBOBOX1
NAME
COMBOBOX1


TEXT
PERSEGI, LINGKARAN
7
COMBOBOX2
NAME
COMBOBOX2


TEXT
MERAH, KUNING, HIJAU
8
TEXTBOX1
NAME
TEXTBOX1


TEXT

9
TEXTBOX2
NAME
TEXTBOX2


TEXT

10
BUTTON1
NAME
BUTTON1


TEXT
JADI
11
BUTTON2
NAME
BUTTON2


TEXT
REFRESH

Tidak ada komentar:

Posting Komentar