[Lazarus] How to obtain the color of a component?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Oct 20 21:46:46 CEST 2011


Felipe Monteiro de Carvalho schrieb:
> Hello,
> 
> Is there any easy way to obtain the color of a component taking into
> considerating all the factors? aka, propagating ParentColor, resolving
> clDefault, etc.
> 
> I have my TCDPageControl on top of a form, but for
> TCDPageControl.Color I get just clDefault, which turns out to be
> black. =( using Parent.GetDefaultColor(dcBrush) also returned black in
> Windows...

There was a complaint about different colors at designtime and runtime, 
in a Delphi group. The real color can depend on the active theme, you 
only can determine it at runtime.

> If there is no easy way maybe we should add one?

I don't know how, but I'd try Canvas or Brush.Color...

DoDi





More information about the Lazarus mailing list