Tuesday, 15 April 2014
Program Mencampur Warna Standar RGB Di VB
Listing VB dibawah ini:
Private Sub Command1_Click()
On Error Resume Next
Picture4.BackColor = RGB(Text1.Text, Text2.Text, Text3.Text)
Text4.Text = ("&text1.text, &text2.text, &text3.text")
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Picture1.BackColor = &H8000000F
Picture2.BackColor = &H8000000F
Picture3.BackColor = &H8000000F
Picture4.BackColor = &H8000000F
Text1.SetFocus
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
Text5.Text = "GHOFAR AFROZI"
Text6.Text = "122077"
Text7.Text = "D TEKNIK INFORMATIKA"
End Sub
Private Sub Command5_Click()
CommonDialog1.Filter = "JPG|*.jpg"
CommonDialog1.ShowOpen
Picture5.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
Private Sub form_activate()
Text1.SetFocus
End Sub
Private Sub form_load()
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
End Sub
Private Sub text1_change()
On Error Resume Next
If Text1.Text = "" Then
Picture1.BackColor = &H8000000F
End If
If Val(Text1.Text) > 255 Then
MsgBox "Nilai yang anda input melebihi jangkauan, yaitu 255", vbOKOnly + vbCritical, "Konfirmasi"
Picture1.BackColor = &H8000000F
Text1.Text = ""
Text1.SetFocus
ElseIf Val(Text1.Text) <= 255 Then
Picture1.BackColor = RGB(Text1.Text, &O0, &O0)
End If
End Sub
Private Sub text2_change()
On Error Resume Next
If Text1.Text = "" Then
Picture1.BackColor = &H8000000F
End If
If Val(Text2.Text) > 255 Then
MsgBox "Nilai yang anda input melebihi jangkauan, yaitu 255", vbOKOnly + vbCritical, "Konfirmasi"
Picture2.BackColor = &H8000000F
Text2.Text = ""
Text2.SetFocus
ElseIf Val(Text2.Text) <= 255 Then
Picture2.BackColor = RGB(&O0, Text2.Text, &O0)
End If
End Sub
Private Sub text3_change()
On Error Resume Next
If Text1.Text = "" Then
Picture1.BackColor = &H8000000F
End If
If Val(Text3.Text) > 255 Then
MsgBox "Nilai yang anda input melebihi jangkauan, yaitu 255", vbOKOnly + vbCritical, "Konfirmasi"
Picture3.BackColor = &H8000000F
Text3.Text = ""
Text3.SetFocus
ElseIf Val(Text3.Text) <= 255 Then
Picture3.BackColor = RGB(&O0, &O0, Text3.Text)
End If
End Sub
Private Sub text3_lostfocus()
If Text3.Text <> "" Then
Command1.SetFocus
End If
End Sub
Labels:
Belajar Program
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment