Kamis, 02 Oktober 2014

“Bentuk Geometri” dengan Visual Basic 6.0

VB6SP6_logo

“Latihan ComboBox” yang terdapat pada eBook “Panduan Praktik Pemrograman Komputer”.

Tidak ada modifikasi yang dibuat. Hanya sekedar mencoba membuat programnya saja. Untuk lebih lengkapnya dapat dilihat pada kode sumber yang disertakan.

 

 

BentukGeometri

VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Bentuk Geometri"
ClientHeight = 4950
ClientLeft = 45
ClientTop = 405
ClientWidth = 7815
BeginProperty Font
Name = "Segoe UI"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4950
ScaleWidth = 7815
StartUpPosition = 2 'CenterScreen
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 13
Top = 4575
Visible = 0 'False
Width = 7815
_ExtentX = 13785
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.ComboBox Combo1
Height = 375
Index = 1
Left = 1560
Style = 2 'Dropdown List
TabIndex = 12
Top = 4320
Width = 1815
End
Begin VB.ComboBox Combo1
Height = 375
Index = 0
Left = 1560
Style = 2 'Dropdown List
TabIndex = 10
Top = 3800
Width = 1815
End
Begin VB.Frame Frame1
Caption = "Bentuk Tertentu:"
Height = 3495
Left = 240
TabIndex = 1
Top = 120
Width = 3015
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 3015
Left = 120
ScaleHeight = 3015
ScaleWidth = 2655
TabIndex = 2
Top = 240
Width = 2655
Begin VB.OptionButton Option1
Caption = "Bulat Persegi Empat"
Height = 495
Index = 5
Left = 240
TabIndex = 8
Top = 2520
Width = 2055
End
Begin VB.OptionButton Option1
Caption = "Bulat Persegi Panjang"
Height = 495
Index = 4
Left = 240
TabIndex = 7
Top = 2040
Width = 2175
End
Begin VB.OptionButton Option1
Caption = "Bulat Telur"
Height = 495
Index = 3
Left = 240
TabIndex = 6
Top = 1560
Width = 1815
End
Begin VB.OptionButton Option1
Caption = "Lingkaran"
Height = 495
Index = 2
Left = 240
TabIndex = 5
Top = 1080
Width = 1815
End
Begin VB.OptionButton Option1
Caption = "Persegi Empat"
Height = 495
Index = 1
Left = 240
TabIndex = 4
Top = 600
Width = 1815
End
Begin VB.OptionButton Option1
Caption = "Persegi Panjang"
Height = 495
Index = 0
Left = 240
TabIndex = 3
Top = 120
Width = 1815
End
End
End
Begin VB.CommandButton Command1
Caption = "K&eluar"
Height = 615
Left = 5760
TabIndex = 0
Top = 3960
Width = 1815
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Warna:"
Height = 255
Index = 1
Left = 360
TabIndex = 11
Top = 4365
Width = 615
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Tebal Garis:"
Height = 255
Index = 0
Left = 360
TabIndex = 9
Top = 3840
Width = 1035
End
Begin VB.Shape Shape1
BackStyle = 1 'Opaque
FillColor = &H00FFFFFF&
Height = 3375
Left = 3480
Top = 240
Width = 4095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click(Index As Integer)
Select Case Index
Case 0:
Shape1.BorderWidth = Val(Combo1(Index).Text)
Case 1:
If Combo1(Index).Text = "Merah" Then
Shape1.BackColor = vbRed
ElseIf Combo1(Index).Text = "Kuning" Then
Shape1.BackColor = vbYellow
ElseIf Combo1(Index).Text = "Hijau" Then
Shape1.BackColor = vbGreen
ElseIf Combo1(Index).Text = "Biru" Then
Shape1.BackColor = vbBlue
ElseIf Combo1(Index).Text = "Hitam" Then
Shape1.BackColor = vbBlack
End If
End Select
End Sub

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim i%
For i = 1 To 5
Combo1(0).AddItem i
Next

Combo1(1).AddItem "Merah"
Combo1(1).AddItem "Kuning"
Combo1(1).AddItem "Hijau"
Combo1(1).AddItem "Biru"
Combo1(1).AddItem "Hitam"

Option1(0).Value = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
If MsgBox("Keluar program ?", vbQuestion + vbYesNo, "Perhatian") = vbNo Then
Cancel = 1
End If
End Sub

Private Sub Option1_Click(Index As Integer)
Select Case Index
Case 0:
If Option1(Index).Value = True Then Shape1.Shape = 0
Case 1:
If Option1(Index).Value = True Then Shape1.Shape = 1
Case 2:
If Option1(Index).Value = True Then Shape1.Shape = 2
Case 3:
If Option1(Index).Value = True Then Shape1.Shape = 3
Case 4:
If Option1(Index).Value = True Then Shape1.Shape = 4
Case 5:
If Option1(Index).Value = True Then Shape1.Shape = 5
End Select
End Sub


Unduh Kode Sumber

Label:

0 Komentar:

Posting Komentar

Berlangganan Posting Komentar [Atom]

<< Beranda