Hi all,
I am developing a windows application.
I have 3 forms:
I want to change the backcolor of all the 3 forms to the color selected by the user.
I have written the following code to do this. But the backcolor is not changed.
In Form1
ColorDialog c1 = new ColorDialog();
public System.Drawing.Color bkc;
private void button1_Click(object sender, EventArgs e)
{
c1.ShowDialog();
bkc = c1.Color;
}
private void button2_Click(object sender, EventArgs e)
{
Form2 obj1 = new Form2();
obj1.Show();
}
In Form 2
private void button1_Click(object sender, EventArgs e)
{
Form3 obj1 = new Form3();
obj1.Show();
}
private void Form2_Load(object sender, EventArgs e)
{
Form1 obj2 = new Form1 ();
this.BackColor = obj2.bkc;
}
In Form3
private void button1_Click(object sender, EventArgs e)
{
Form1 obj1 = new Form1();
obj1.Show();
}
private void Form3_Load(object sender, EventArgs e)
{
Form1 obj2 = new Form1();
this.BackColor = obj2.bkc;
}
In the color dialog box I am selecting a color but the color and pressing Ok button but the color is not changed.
The above code does not generate any error.
can anybody help me out in performing this task?
Thanks in advance!