Domanda

I want to have a little square that will display the color currently selected by a color dialog.

It should look like this: Picture of what I want

And the green box, should update to another color when they choose one. How would I go about doing this?

È stato utile?

Soluzione

Using colorDialog As New ColorDialog
    'If the user actually selected a color Then
    If colorDialog.ShowDialog() = DialogResult.OK Then
        'Set the background color of the picture box = color selected from the color dialog
        PictureBox1.BackColor = colorDialog.Color
    End If
End Using

Place this code in your Button_Click event handler.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top