tags:

views:

564

answers:

3

Hi,

I want to change color of a panel according to current selected Windows theme. I have set the prop EnableVisStyles. It changes things like toolbar and Windows form's title bar. However the panel color remains same. Is there any way to achieve this?.

Regards, Harsh Suman

+2  A: 

You have probably set the Form or the Panel's color. Go into the designer, and check the BackColor property on your form and the panel. They should be set to Control (under the System tab), not to a specific color.

Rob Prouse
A: 

I think Rob is right. You can also right click the property and select Reset.

JAG
A: 

There are two different sets of colours available. In leiu of better terms, let's call them literal colours and system colors.

Literal colours are fixed and always stay the same. If you set the panel to gray, it will always be gray.

System colours are dynamic - they're named for a purpose and change with the system theme. For example, the system colour "Control" is the colour for control backgrounds. Usually, this is gray, but it can change.

In Windows.Forms, Literal colours are available as static properties on System.Drawing.Color, while system colours are available as static properties on System.Drawing.Systemolors.

I think things are slightly different with WPF, but that's not an area I'm yet familiar with.

Bevan