Click here to Skip to main content
15,905,073 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to change all backcolor of my forms in just i click of color dialog. how would i do that?

thanks in advance =)
Posted

I think the purpose of changing the backcolor of forms may be for different themes, in which case the following article may be useful to you

Fancy Windows Forms[^]


If you problem is solved you may accept and vote the solution, otherwise please post your queries

PES
 
Share this answer
 
just try this..

C#
colorDialog1.ShowDialog();
this.BackColor = colorDialog1.Color;
 
Share this answer
 
Comments
newbie011292 23-Feb-12 4:23am    
yes sir but i want all my forms, i got many forms in my system .but thanks anyways
This is how you can apply backcolor to all forms within your project.

C#
using System.Reflection;

private void btnChangeFormColor(object sender, EventArgs e)
{
    colorDialog1.ShowDialog();
    Color backcolor = colorDialog1.Color;

    //Get all Forms within the project
    Type[] AllTypesInProjects = Assembly.GetExecutingAssembly().GetTypes();
    for(int i=0;i<AllTypesInProjects.Length;i++)
    {
        if (AllTypesInProjects[i].BaseType == typeof(Form))
        {
            /* Convert Type to Object */
            Form f = (Form)Activator.CreateInstance(AllTypesInProjects[i]);
            f.BackColor = backcolor;            
        }

    }

}

Source for getting all forms within project:
http://codeindex.blogspot.in/2011/11/get-list-of-all-forms-in-project-using.html[^]
 
Share this answer
 
Comments
newbie011292 23-Feb-12 8:49am    
sir nothing happens.

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