In Visual Basic 6.0 you can create amazing color changing program, you can use the
RGB (Red, Green, Blue) color and combine them using your color changer program. I know that you gonna say WOW! if you finish and runs this program. You wanna know, because it’s AMAZING!
I want to share this to all beginners in Visual Basic 6.0 to let you experience what I am saying. Here are the procedures you are going to follow in order for you to create a color changing program, simply follow all the steps correctly to avoid errors.
1. Open a new form and change its name to frmColorChanger
Create and place the following objects on this form.
- A heading label1 (Caption=Color Changing)
- 3 horizontal scroll bars (Set the max value property of all three to 255)
- 3 labels (Red, Green, Blue)
- Another 1 label under the horizontal scroll bars1 (Caption=Wow!)
Just look like this:
2. Double click each scrollbar and add the following code to its_onChance() event.
lblHeader.BackColor = RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value)
lblBody.BackColor = RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value)
lblHeader.ForeColor = RGB(255 - hsbRed.Value, 225 - hsbGreen.Value, 255 - hsbBlue.Value)
lblBody.ForeColor = RGB(255 - hsbRed.Value, 255 - hsbGreen.Value, 255 - hsbBlue.Value)
lblRed.BackColor = RGB(hsbRed.Value, 0, 0)
lblGreen.BackColor = RGB(0, hsbGreen.Value, 0)
lblBlue.BackColor = RGB(0, 0, hsbBlue.Value)
3. Double click the return command button and add the following code to its_onClick() event.
Unload Me
4. Use <F5> function key to test your project. Save and backup.
Done, Just look like this:
I hope it will help you to enhance your Microsoft Visual Basic skills and to create more amazing program in the future.