VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



RGB Form Colour Changer

by JamesJD (11 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

This little code will allow you to change the forms colour using Scroll Bar and Text Boxes, this can be changed to change the colour of a Text Box, etc. Please vote and leave your comments :)

Inputs
Three Scroll Bars named: hsbRed, hsbGreen, and hsbBlue. Also three Text Boxes named: txtRed, txtGreen, and txtBlue.

Rate RGB Form Colour Changer

Private Sub Form_Load()
  hsbRed.Value = 255
  hsbGreen.Value = 255
  hsbBlue.Value = 255
End Sub
Private Sub hsbBlue_Change()
  Form1.BackColor = RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value)
  txtBlue.Text = hsbBlue.Value
End Sub
Private Sub hsbGreen_Change()
  Form1.BackColor = RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value)
  txtGreen.Text = hsbGreen.Value
End Sub
Private Sub hsbRed_Change()
  Form1.BackColor = RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value)
  txtRed.Text = hsbRed.Value
End Sub
Private Sub txtBlue_Change()
  hsbBlue.Value = txtBlue.Text
End Sub
Private Sub txtGreen_Change()
  hsbGreen.Value = txtGreen.Text
End Sub
Private Sub txtRed_Change()
  hsbRed.Value = txtRed.Text
End Sub

Download this snippet    Add to My Saved Code

RGB Form Colour Changer Comments

No comments have been posted about RGB Form Colour Changer. Why not be the first to post a comment about RGB Form Colour Changer.

Post your comment

Subject:
Message:
0/1000 characters