CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    94

    changing background color

    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;


    }

  2. #2
    Join Date
    Nov 2003
    Posts
    2,185

    Re: changing background color

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured