xp styles and control forecolor problems

  • Thread starter Thread starter Bernie Yaeger
  • Start date Start date
B

Bernie Yaeger

When you use xp styles

Application.EnableVisualStyles()

Application.DoEvents()



and you change a control's flat style to 'system', you then are not able to
set the control's forecolor, or if you did set it, it reverts to the default
forecolor. Any way to change the forecolor even if xp styles are on and the
flat style is system?



Thanks for any help.



Bernie Yaeger
 
* "Bernie Yaeger said:
When you use xp styles

Application.EnableVisualStyles()

Application.DoEvents()

and you change a control's flat style to 'system', you then are not able to
set the control's forecolor, or if you did set it, it reverts to the default
forecolor. Any way to change the forecolor even if xp styles are on and the
flat style is system?

No. You cannot change the color of themed controls.
 
Hi Herfried,

Tx for the answer; too bad. Maybe in the next release of the framework.

Bernie
 
Setting FlatStyle to System causes the control to use the current
System.Colors. In order to use your own colors and apply Visual Styles you
must OwnerDraw the control. I have written a Button control which Inherits
from button and allows you to Apply Visual Styles with the FlatStyle set to
Standard. As well as still using your choice of ForeColor, it allows you to
use the Image. You can find this controls SourceCode at:

<www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=1900&lngWId=10>

I used a complicated method to draw the background and have since discovered
the DrawThemeParentBackground API call which does that for you, but I will
not be updating the source as the method I used shows how to test for a
property in another control and that could be beneficial.

You can use this example as a guide to create other controls which behave
similarly.
 
Back
Top