New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms ColorBox

The following example demonstrates how to change the ForeColor of RadLabel by using the RadColorBox.

Figure 1: Synchronize Color.

WinForms RadColorBox Synchronize Color

1. Drag RadLabel and RadColorBox to a form.

2. Select the RadColorBox, click the Events tab of the Property Window, locate the ValueChanged event and double-click it to create an event handler. Replace the event handler with the following code.

private void radColorBox1_ValueChanged(object sender, EventArgs e)
    this.radLabel1.ForeColor = this.radColorBox1.Value;

Private Sub RadColorBox1_ValueChanged(sender As Object, e As EventArgs)
    Me.RadLabel1.ForeColor = Me.RadColorBox1.Value
End Sub

3. Press F5 to run the application. Press the color dialog button and select a color. The color is then applied as ForeColor of the RadLabel.

See Also

Telerik UI for WinForms Learning Resources

In this article