Visual Basic – Colorpicker
Colorpicker With this script you can pick a color easily and set a color to a label (Visual Studio 2017): Needed: Button Label ColorDialog
1 2 3 4 5 6 7 8 |
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim colors As DialogResult colors = ColorDialog1.ShowDialog If colors = Windows.Forms.DialogResult.OK Then Label1.ForeColor = ColorDialog1.Color End If End Sub |
To get the RGB values 0-255 you can use:
1 2 3 |
Label1.Text = ColorDialog1.Color.R Label2.Text = ColorDialog1.Color.G Label3.Text = ColorDialog1.Color.B |