1
votes

I am starting with Delphi VCL styles and I see that it is very easy to apply a predefined style using 'Project | Options' and then 'Application | Appearance'.

Naturally these styles affect the whole look and feel of the Application. I would like to keep the default Windows style (I'm using 'Runtime themes enabled') but I want to change the default white background shown by TPageControl. I came across this excellent article on creating colourful page control tabs which shows how to override the colouring of the tabs, but it seems to apply only when a style is loaded.

My question is how (whether?) I can use TStyleServices without loading a style file to get at only the TTabSheet components and set a colour?

(And yes, I know that there are a number of other TPageControl replacements available, I want to stick with the standard controls).

1
VCL styles is perhaps heavy for this task. Just paint the background.David Heffernan
I'll look into this, thanks.Brian Frost

1 Answers

2
votes

You can access the elements (colors, images) of the loaded VCL Styles in anytime even if the Windows native style is active.

var
  LStyleServices : TCustomStyleServices;
begin
  LStyleServices:=TStyleManager.Style['AnyLoadedVclStyle'];
  //draw with the LStyleServices 
  ....       
end;

But only you can use the Vcl Style hooks to draw the controls when a custom style is selected.