I need to change the color of a TPanel when the VCL styles are enabled. I tried using and modifying the code listed in the article Changing the color of Edit Controls with VCL Styles Enabled, but it is not working for a TPanel. How I can change the color of a TPanel with the VCL Styles enabled?
相关问题
- Is there a Delphi 5 component that can handle .png
- Is there a way to install Delphi 2010 on Windows 2
- Is TWebBrowser dependant on IE version?
- iOS objective-c object: When to use release and wh
- DBGrid - How to set an individual background color
相关文章
- Best way to implement MVVM bindings (View <-> V
- Windows EventLog: How fast are operations with it?
- How to force Delphi compiler to display all hints
- Coloring cell background on firemonkey stringgrid
- HelpInsight documentation in Delphi 2007
- Can RTTI interrogate types from project code at de
- What specifically causes EPrivilege to be raised?
- Equivalent to designer guidelines in code
In XE5, if you turn off the seClient flag in the StyleElements property, then the Color property works again as expected.
Based on @costa's answer, use:
in the constructor of your TPanel descendent class
or if you just have some TPanel (or descendent class) instance you can do:
The -[...] syntax is used since the StyleElements is a set
For more on StyleElements read this article:
Tuning VCL Styles for Forms and Controls - http://edn.embarcadero.com/article/42812
The
TPanel
doesn't use a style hook to draw the control, so you can't use the technique described in the article. instead you must override thepaint
method.Check this sample using a interposer class.