- Seperti biasa pertama buka Visual Basicnya dan pilih VB Enterprise Edition Controls
- Lalu agan masukan componen di bawah ini , dan ubah sesuai yang di bawah ini
Name | Atribut | |
---|---|---|
Shape1 | BackStyle | 1-Opaque |
Command1 | Caption | &Ubah Warna |
List1 | - | - |
CommonDialog | - | - |
- Jika componen yang di butuhkan sudah di masukan ke form sekarang tinggal masukan coding di bawah ini:
Private Sub Command1_Click()
CommonDialog1.Flags = &H1&
CommonDialog1.ShowColor
Shape1.BackColor = CommonDialog1.Color
End Sub
Private Sub Form_Load()
List1.AddItem "Persegi Panjang"
List1.AddItem "Kotak"
List1.AddItem "Lonjong"
List1.AddItem "Lingkaran"
List1.AddItem "Persegi Panjang Bulat"
List1.AddItem "Bulat Persegi"
End Sub
Private Sub List1_Click()
Select Case List1.ListIndex
Case 0
Shape1.Shape = 0
Case 1
Shape1.Shape = 1
Case 2
Shape1.Shape = 2
Case 3
Shape1.Shape = 3
Case 4
Shape1.Shape = 4
Case 5
Shape1.Shape = 5
End Select
End Sub
CommonDialog1.Flags = &H1&
CommonDialog1.ShowColor
Shape1.BackColor = CommonDialog1.Color
End Sub
Private Sub Form_Load()
List1.AddItem "Persegi Panjang"
List1.AddItem "Kotak"
List1.AddItem "Lonjong"
List1.AddItem "Lingkaran"
List1.AddItem "Persegi Panjang Bulat"
List1.AddItem "Bulat Persegi"
End Sub
Private Sub List1_Click()
Select Case List1.ListIndex
Case 0
Shape1.Shape = 0
Case 1
Shape1.Shape = 1
Case 2
Shape1.Shape = 2
Case 3
Shape1.Shape = 3
Case 4
Shape1.Shape = 4
Case 5
Shape1.Shape = 5
End Select
End Sub
- Jika sudah di masukan codingnya coba di Run atau tekan F5 .
Tidak ada komentar:
Posting Komentar