Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
Hi Friends
How to change windows form application color dynamically with changing the color of other component like button etc., how i can use color picker to change the color of my application with different color combination. Please help.
Posted

Use System.Windows.Forms.Control.BackColor and System.Windows.Forms.Control.ForeColor. There are read/write properties, so you can modify background or foreground color of any control (it includes Form) at any time. Assignment of the color (System.Drawing.Color) will automatically invalidate the control's rendering, so all you need is assignment:

C#
myButton.BackColor = System.Drawing.Colors.Wheat;


—SA
 
Share this answer
 
FormId.Color=Color.Red;


like
that u can change color of any control
 
Share this answer
 
suppose your form has name frmLogin and you want to change forecolor and backcolor dynamically and for that you have Login button if user name and password is wrong then you want to change the color..
so the code will like this...
private void frmLogin_Load(object sender, EventArgs e)
{
    // if user name and password is wrong then give some proper message and change the color like this...
    frmLogin.BackColor = System.Drawing.Color.Yellow;
    frmLogin.ForeColor = System.Drawing.Color.Red;
}


Thanks,
 
Share this answer
 
try this link....

http://www.codeproject.com/KB/vb/Ravindra@eSoft.aspx
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900