Click to See Complete Forum and Search --> : changing background color


cyn8
July 18th, 2007, 04:52 AM
Hi, i've got a problem here. i can't figure out why my form background and also the button change its color when i call the function below. how can i ensure that only the background changes? besides that, in the form i also need to draw and show some circles. How to ensure that when the background color changes, it still there?

public void b1_click(object sender, EventArgs e)
{
clg.ShowDialog();
this.BackColor = clg.Color;


}

Tischnoetentoet
July 18th, 2007, 07:09 AM
Child controls automatically use the colors of their parents. This is the same as when you disable a groupbox, all controls in that groupbox get disabled.

You must manually set the background color of all child controls that should behave differently or use the Paint event to paint the forms background yourself.