' Pink Example ' As the trackbar is moved, change the background color of the ' picture box from red to pink to white. Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents trkColor As System.Windows.Forms.TrackBar Friend WithEvents picBox As System.Windows.Forms.PictureBox Private Sub InitializeComponent() Me.trkColor = New System.Windows.Forms.TrackBar Me.picBox = New System.Windows.Forms.PictureBox CType(Me.trkColor, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'trkColor ' Me.trkColor.Location = New System.Drawing.Point(24, 24) Me.trkColor.Maximum = 255 Me.trkColor.Name = "trkColor" Me.trkColor.Size = New System.Drawing.Size(232, 45) Me.trkColor.TabIndex = 0 Me.trkColor.TickFrequency = 16 ' 'picBox ' Me.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.picBox.Location = New System.Drawing.Point(40, 96) Me.picBox.Name = "picBox" Me.picBox.Size = New System.Drawing.Size(208, 128) Me.picBox.TabIndex = 1 Me.picBox.TabStop = False ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 266) Me.Controls.Add(Me.picBox) Me.Controls.Add(Me.trkColor) Me.Name = "Form1" Me.Text = "Pink Example" CType(Me.trkColor, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load picBox.BackColor = Color.Red End Sub Private Sub trkColor_Scroll(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles trkColor.Scroll Dim x As Integer = trkColor.Value Dim pinkShade As Color = Color.FromArgb(255, x, x) picBox.BackColor = pinkShade End Sub End Class