how do i set the background color of my form to what the user picks from colordialog?
views:
35answers:
1
+2
A:
Simply assign the BackColor
property of the form with the value of the Color
property of the ColorDialog
:
Dim cd As New ColorDialog()
If cd.ShowDialog() = DialogResult.OK Then
Me.BackColor = cd.Color
End If
Fredrik Mörk
2009-07-31 19:45:42
cool, should i put this into the form load event?
I__
2009-07-31 19:53:19
Only if you want the color dialog to show each time the form is displayed (which I doubt). Put a button or a menu item on the form instead, and put it in the click event of that control.
Fredrik Mörk
2009-07-31 19:55:15