Change the button color at Runtime depending on property when VCL Styles are applied

407 Views Asked by At

I am working with VCL styles in Delphi 10.2.

I have a MyButtonStyle property on a custom button component - TMyButton, which inherits from TButton.

type
  MyButtonStyle = ('Default', 'Red', 'Yellow', 'Green');

Based on the MyButtonStyle property values:

When a VCL Style is applied, I want to change the color of TMyButton to either: Default (default selected style color), Red, Yellow, or Green.

Any idea how this can be achieved?

I tried using the Bitmap Style Designer in Delphi. But it allows selecting a color only at design-time. How to achieve this at runtime?

0

There are 0 best solutions below