Skip to content
The Road to Delphi — Delphi, VCL, VCL Styles, UxTheme and WinAPI

VCL Styles Utils – Major Update (Dialogs, ProgressBar, DateTimePicker, ListView and more)

, ,

A Major updated was made to the VCL Styles Utils project. This version include several fixes and new features.

Vcl.Styles.Hooks

The Vcl.Styles.Hooks unit is the most updated part of this new release. This unit is the responsible of hook some of the UxTheme and WinApi methods like DrawThemeBackground, GetSysColor and GetSysColorBrush. Which allows take the control of the painting process for the system themed (and owner-draw) controls.

ListView

This new release fix the highlight color used on the selected items and also replace the themed checkBox by a styled checkbox.

ListView with VCL Styles
2014-11-04 11_08_19-Demo

ListView with VCL Styles + Vcl.Styles.Hooks unit
2014-11-04 11_08_55-Demo

Also was added support for style the Listview groups.

ListView with VCL Styles

2014-11-04 11_11_23-Demo

ListView with VCL Styles + Vcl.Styles.Hooks unit

2014-11-04 11_12_45-Demo

DateTime Controls

The Styling of the TMonthCalendar and TDatetimepicker components is one of the limitations of the VCL Styles, because such components are owner-draw by the system and doesn’t allow to customize the look and feel when the native themes are enabled (for more information read these TMonthCalendar and TDatetimepicker ) also only the newest versions of Delphi includes a partial styling support for such components. With this new release the styling of these controls is now possible.

TDateTimePicker and TMonthCalendar with VCL Styles

2014-11-04 11_29_24-Demo - RAD Studio XE7 - uMain [Running] [Built]

TDateTimePicker and TMonthCalendar with VCL Styles + Vcl.Styles.Hooks unit

2014-11-04 11_54_31-Demo - Embarcadero RAD Studio XE2 - Vcl.Styles.Hooks [Running] [Built]

ProgressBar

Improved support for the TProgressbar component without flicker and with Marquee style.

2014-11-04 14_48_10-Demo

Select Directory Dialog

The styling for the select directory dialog was enhanced adding support for the open and close glyphs and fixing the color of the highlight bar.

VCL Styles Utils

2014-11-04 15_01_14-Browse For Folder

VCL Styles Utils + Vcl.Styles.Hooks unit

2014-11-04 15_01_52-Greenshot

Open/Save Dialog

The VCL Styles support of the Open and Save dialogs was improved adding styling for groups and highlight items. Also a fix for the select folder combobox was introduced.

VCL Styles Utils

2014-11-04 15_12_50-Open

2014-11-04 15_20_49-Open

2014-11-04 15_26_07-ThemedSysControls - Embarcadero RAD Studio XE2 - ThemedSysControls.dproj [Runnin

VCL Styles Utils + Vcl.Styles.Hooks unit

2014-11-04 15_14_27-Open

2014-11-04 15_21_25-Open

2014-11-04 15_25_16-Edit Post ‹ The Road to Delphi - a Blog about programming — WordPress

20 responses

  1. Hello, when i try to add vcl.styles.hooks and vcl.styles.utils to a project I get exception in the system.generics.collections unit. function TDictionary.GetItem(const key : TKey): TValue The error is Item not found.
    If I remove your two units and just style as normal all works fine. Any ideas?

    1. Thanks for the feedback, you can report this using the issue page of the project, attaching a sample project to reproduce the issue.

    2. @Steve: Do you use Project options -> Delphi Compiler -> Compiling -> Runtime errors -> Overflow checking / Range checking?

  2. Rodrigo, you are my hero!
    You find a way to style the ListView Group Header!
    That’s sooo great!!!

    But I found one issue with the background drawing of the calendar.
    The hot items (days) remain selected painted.

    Please replace in Vcl.Styles.Hooks.pas function Detour_UxTheme_DrawThemeMain line 587 this code with the following code with local canvas to clear the background:

    { old version
    MC_BACKGROUND,
    MC_BORDERS,
    MC_GRIDBACKGROUND : begin
    SaveIndex := SaveDC(hdc);
    try
    LDetails:=StyleServices.GetElementDetails(teBackgroundNormal);
    StyleServices.DrawElement(hdc, LDetails, pRect, nil);
    finally
    RestoreDC(hdc, SaveIndex);
    end;
    Result:=S_OK;
    end;”
    }

    MC_BACKGROUND,
    MC_BORDERS,
    MC_GRIDBACKGROUND :
    begin
    SaveIndex := SaveDC(hdc);
    LCanvas := TCanvas.Create;
    try
    LCanvas.Handle := hdc;
    LCanvas.Brush.Color := StyleServices.GetStyleColor(scGenericBackground);
    LCanvas.FillRect(pRect);

    LDetails := StyleServices.GetElementDetails(teBackgroundNormal);
    StyleServices.DrawElement(hdc, LDetails, pRect, nil);
    finally
    LCanvas.Handle := 0;
    LCanvas.Free;
    RestoreDC(hdc, SaveIndex);
    end;
    Result := S_OK;
    end;

    1. Thanks, I but can’t reproduce which you describe. please use the issue page of the project to report this.

      1. see issue 94!

  3. […] A Major updated was made to the VCL Styles Utils project. This version include several fixes and new features. Vcl.Styles.Hooks The Vcl.Styles.Hooks unit is the most updated part of this new release.  […]

  4. Can this be used with Delphi XE7 Starter Edition?

    I tried but will not compile due cannot find StyleUtils.inc StylesAPI.inc.

    1. Try modifyng the Vcl.Styles.Ext unit, comment the line 26 {$DEFINE USE_VCL_STYLESAPI}.

      1. No luck.

        Tried compiling Basic Demo.

        First Error:

        [dcc32 Error] Vcl.Styles.Utils.pas(42): E2003 Undeclared identifier: ‘TCustomStyleExt’

        1. The TCustomStyleExt component and the Vcl.Styles.Utils unit only can be used if you have the source code of the VCL Styles. but you can use all the other features of the library with the Starter Edition.

          1. So what do I do with the class TVclStylesUtils which has a TCustomStyleExt field?

  5. Hi Bob, I just edited my original answer (sorry for that), the Vcl.Styles.Utils unit cannot be used in the starter edition, but this is just a very small part of the library.

  6. OK. Thanks for your replies.

  7. Can you apply styles to TTreeView Delphi component?

    1. Yes, the TTreeView control is supported by the VCL Styles.

  8. useridx64 Avatar
    useridx64

    Hi Rodrigo,,
    How to excluding “Title bar” from VCL style?
    Thanks :)

      1. useridx64 Avatar
        useridx64

        You save my life!
        Thank you very much :-)

Leave a Reply