Represents a good control horizontal scroll bar of Windows standard, this screen will see how to change the colors to a panel control by controlling HScrollBar.
Public Class Form1_WiseCodes Private Sub Red_HScrollBar_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Red_HScrollBar.ValueChanged ColorPerview_Panel1.BackColor = ColorTranslator.FromOle(RGB(0 + Red_HScrollBar.Value, Green_HScrollBar.Value + 0, 0 + Blue_HScrollBar.Value)) lblRedValue.Text = Red_HScrollBar.Value End Sub Private Sub Green_HScrollBar_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Green_HScrollBar.ValueChanged ColorPerview_Panel1.BackColor = ColorTranslator.FromOle(RGB(0 + Red_HScrollBar.Value, Green_HScrollBar.Value + 0, 0 + Blue_HScrollBar.Value)) lblGreenValue.Text = Green_HScrollBar.Value End Sub Private Sub Blue_HScrollBar_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Blue_HScrollBar.ValueChanged ColorPerview_Panel1.BackColor = ColorTranslator.FromOle(RGB(0 + Red_HScrollBar.Value, Green_HScrollBar.Value + 0, 0 + Blue_HScrollBar.Value)) lblBlueValue.Text = Blue_HScrollBar.Value End Sub End Class
Set Values of all the HScrollBar as following . The three arguments (red, green & blue) must each be in the range 0 to 255.
Download Source Code
Happy Programming!!






