Allow user to customize form background color using ColorDialog
The Windows Forms ColorDialog component is a pre-configured dialog box that allows the user to select a color from a palette and to add custom colors to that palette. It is the same dialog box that you see in other Windows-based applications to select colors. Use it within your Windows-based application as a simple solution in lieu of configuring your own dialog box.
To add the dialog to Windows Form select the ColorDialog from the tool box
Use the following code to show the dialog and set the selected color as the background of the form
private void btnSelectColor_Click(object sender, EventArgs e)
{
colorDialog1.ShowDialog();
this.BackColor = colorDialog1.Color;
}
awesome code
ReplyDeleteSeriously...
ReplyDeletewhy did you write this article?
how to add color dialog box in c# web applications?
ReplyDelete