├── .gitignore ├── Demo ├── Data │ ├── License.html │ ├── biolife.xml │ └── biolife_png.xml ├── Fonts │ └── Material Design Icons Desktop.ttf ├── Images │ ├── DarkLightThemes.jpg │ ├── DemoPreview.jpg │ ├── DemoPreviewD10_4.jpg │ ├── DemoPreviewD11_Dark.jpg │ ├── DemoPreviewStyledComponents.jpg │ ├── DemoPreview_D11_Light.jpg │ ├── Launcher..jpg │ ├── PreviewD10_3.jpg │ ├── PreviewD10_4.jpg │ └── SupportingDelphi.jpg ├── Projects │ ├── D10_1 │ │ ├── ModernAppDemo.dpr │ │ ├── ModernAppDemo.dproj │ │ ├── ModernAppDemo.res │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── D10_2 │ │ ├── ModernAppDemo.dpr │ │ ├── ModernAppDemo.dproj │ │ ├── ModernAppDemo.res │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── D10_3 │ │ ├── ModernAppDemo.dpr │ │ ├── ModernAppDemo.dproj │ │ ├── ModernAppDemo.res │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── D10_4 │ │ ├── ModernAppDemo.dpr │ │ ├── ModernAppDemo.dproj │ │ ├── ModernAppDemo.res │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── D11 │ │ ├── ModernAppDemo.dpr │ │ ├── ModernAppDemo.dproj │ │ ├── ModernAppDemo.res │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── D12 │ │ ├── ModernAppDemo.dpr │ │ ├── ModernAppDemo.dproj │ │ ├── ModernAppDemo.res │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── DXE3 │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── DXE6 │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ ├── DXE8 │ │ ├── VCLThemeSelectorLauncher.dpr │ │ ├── VCLThemeSelectorLauncher.dproj │ │ └── VCLThemeSelectorLauncher.res │ └── Ethea_vela_multires.ico └── Source │ ├── DImageCollections.dfm │ ├── DImageCollections.pas │ ├── DemoAbout.dfm │ ├── DemoAbout.pas │ ├── EditForm.dfm │ ├── EditForm.pas │ ├── LauncherForm.dfm │ ├── LauncherForm.pas │ ├── uSplitView.dfm │ └── uSplitView.pas ├── Doc ├── Delphi Live 2020-04-29.pdf ├── Delphi-Developers-Guide-4K.pdf └── Delphi_Day_2020_Modernizzare_App_VCL.pdf ├── Ext └── VCLStyleUtils │ ├── Common │ ├── AwesomeFont.RC │ ├── AwesomeFont.RES │ ├── AwesomeFont_zip.RC │ ├── AwesomeFont_zip.RES │ ├── CompileResources.bat │ ├── CompileResources_zip.bat │ ├── VCL.Styles.Utils.inc │ ├── Vcl.PlatformVclStylesActnCtrls.pas │ ├── Vcl.Styles.ColorTabs.pas │ ├── Vcl.Styles.ControlColor.pas │ ├── Vcl.Styles.DPIAware.pas │ ├── Vcl.Styles.DateTimePickers.pas │ ├── Vcl.Styles.DbGrid.pas │ ├── Vcl.Styles.Ext.pas │ ├── Vcl.Styles.Fixes.pas │ ├── Vcl.Styles.FontAwesome.pas │ ├── Vcl.Styles.FormStyleHooks.pas │ ├── Vcl.Styles.Hooks.pas │ ├── Vcl.Styles.NC.pas │ ├── Vcl.Styles.OwnerDrawFix.pas │ ├── Vcl.Styles.Preview.pas │ ├── Vcl.Styles.Register.pas │ ├── Vcl.Styles.Utils.ComCtrls.pas │ ├── Vcl.Styles.Utils.Forms.pas │ ├── Vcl.Styles.Utils.Graphics.pas │ ├── Vcl.Styles.Utils.Menus.pas │ ├── Vcl.Styles.Utils.Misc.pas │ ├── Vcl.Styles.Utils.ScreenTips.pas │ ├── Vcl.Styles.Utils.StdCtrls.pas │ ├── Vcl.Styles.Utils.SysControls.pas │ ├── Vcl.Styles.Utils.SysStyleHook.pas │ ├── Vcl.Styles.Utils.SystemMenu.pas │ ├── Vcl.Styles.Utils.pas │ ├── Vcl.Styles.UxTheme.pas │ ├── Vcl.Styles.WebBrowser.pas │ ├── fontawesome.ttf │ └── fontawesome.zip │ ├── DDetours │ └── Source │ │ ├── CPUID.pas │ │ ├── DDetours.pas │ │ ├── DDetoursDefs.inc │ │ ├── InstDecode.pas │ │ ├── LegacyTypes.pas │ │ ├── ModRmFlagsTables.inc │ │ ├── OpCodesTables.inc │ │ └── TlHelp32.inc │ └── README.md ├── LICENSE ├── README.htm ├── README.md ├── Source ├── CBVCLStylePreview.pas ├── CBVCLStylePreviewForm.dfm ├── CBVCLStylePreviewForm.pas ├── FVCLThemeSelector.dfm ├── FVCLThemeSelector.pas └── VCLThemeSelector.inc └── TestFontDPI ├── ChildUnit.dfm ├── ChildUnit.pas ├── MainUnit.dfm ├── MainUnit.pas ├── TestFontDPI.dpr ├── TestFontDPI.dproj └── TestFontDPI.res /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | *.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | # Boss dependency manager vendor folder https://github.com/HashLoad/boss 69 | modules/ 70 | -------------------------------------------------------------------------------- /Demo/Data/License.html: -------------------------------------------------------------------------------- 1 | Biolife.xml sample data from Embarcadero Embarcadero 2 | Fishes images free pictures from: freepnglogos -------------------------------------------------------------------------------- /Demo/Fonts/Material Design Icons Desktop.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Fonts/Material Design Icons Desktop.ttf -------------------------------------------------------------------------------- /Demo/Images/DarkLightThemes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/DarkLightThemes.jpg -------------------------------------------------------------------------------- /Demo/Images/DemoPreview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/DemoPreview.jpg -------------------------------------------------------------------------------- /Demo/Images/DemoPreviewD10_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/DemoPreviewD10_4.jpg -------------------------------------------------------------------------------- /Demo/Images/DemoPreviewD11_Dark.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/DemoPreviewD11_Dark.jpg -------------------------------------------------------------------------------- /Demo/Images/DemoPreviewStyledComponents.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/DemoPreviewStyledComponents.jpg -------------------------------------------------------------------------------- /Demo/Images/DemoPreview_D11_Light.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/DemoPreview_D11_Light.jpg -------------------------------------------------------------------------------- /Demo/Images/Launcher..jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/Launcher..jpg -------------------------------------------------------------------------------- /Demo/Images/PreviewD10_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/PreviewD10_3.jpg -------------------------------------------------------------------------------- /Demo/Images/PreviewD10_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/PreviewD10_4.jpg -------------------------------------------------------------------------------- /Demo/Images/SupportingDelphi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Images/SupportingDelphi.jpg -------------------------------------------------------------------------------- /Demo/Projects/D10_1/ModernAppDemo.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020, 2024 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | program ModernAppDemo; 24 | 25 | uses 26 | Vcl.Forms, 27 | System.SysUtils, 28 | Vcl.Themes, 29 | Vcl.Styles, 30 | MidasLib, 31 | {$IFDEF STYLEDCOMPONENTS} 32 | Vcl.StyledButton, 33 | Vcl.ButtonStylesAttributes, 34 | Vcl.StyledDbNavigator, 35 | Vcl.StyledToolbar, 36 | Vcl.StyledButtonGroup, 37 | Vcl.StyledCategoryButtons, 38 | {$ENDIF} 39 | uSplitView in '..\..\Source\uSplitView.pas' {FormMain}, 40 | EditForm in '..\..\Source\EditForm.pas' {FmEdit}, 41 | FVCLThemeSelector in '..\..\..\Source\FVCLThemeSelector.pas' {VCLThemeSelectorForm}, 42 | DImageCollections in '..\..\Source\DImageCollections.pas' {ImageCollectionDataModule: TDataModule}, 43 | DemoAbout in '..\..\Source\DemoAbout.pas' {FrmAbout}; 44 | 45 | {$R *.res} 46 | 47 | begin 48 | Application.Initialize; 49 | Application.MainFormOnTaskbar := True; 50 | Application.Title := 'Modern App and ThemeSelector Demo with HighDPI support'; 51 | //Uses System Style for border / shadow of Forms 52 | TStyleManager.FormBorderStyle := TStyleManager.TFormBorderStyle.fbsSystemStyle; 53 | 54 | {$IFDEF STYLEDCOMPONENTS} 55 | TStyledButton.RegisterDefaultRenderingStyle(btRounded); 56 | TStyledDbNavigator.RegisterDefaultRenderingStyle(btRounded); 57 | TStyledButtonGroup.RegisterDefaultRenderingStyle(btRounded); 58 | TStyledCategoryButtons.RegisterDefaultRenderingStyle(btRounded); 59 | TStyledToolbar.RegisterDefaultRenderingStyle(btRoundRect); 60 | {$ENDIF} 61 | 62 | Application.CreateForm(TImageCollectionDataModule, ImageCollectionDataModule); 63 | Application.CreateForm(TFormMain, FormMain); 64 | Application.Run; 65 | end. 66 | -------------------------------------------------------------------------------- /Demo/Projects/D10_1/ModernAppDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_1/ModernAppDemo.res -------------------------------------------------------------------------------- /Demo/Projects/D10_1/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 27 | Vcl.Themes, 28 | Vcl.Styles; 29 | 30 | {$R *.res} 31 | 32 | begin 33 | Application.Initialize; 34 | Application.MainFormOnTaskbar := True; 35 | Application.Title := 'VCLThemeSelector Launcher'; 36 | Application.CreateForm(TLauncher, Launcher); 37 | Application.Run; 38 | end. 39 | -------------------------------------------------------------------------------- /Demo/Projects/D10_1/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_1/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/D10_2/ModernAppDemo.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020, 2024 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | program ModernAppDemo; 24 | 25 | uses 26 | Vcl.Forms, 27 | System.SysUtils, 28 | Vcl.Themes, 29 | Vcl.Styles, 30 | MidasLib, 31 | {$IFDEF STYLEDCOMPONENTS} 32 | Vcl.StyledButton, 33 | Vcl.ButtonStylesAttributes, 34 | Vcl.StyledDbNavigator, 35 | Vcl.StyledToolbar, 36 | Vcl.StyledButtonGroup, 37 | Vcl.StyledCategoryButtons, 38 | {$ENDIF} 39 | uSplitView in '..\..\Source\uSplitView.pas' {FormMain}, 40 | EditForm in '..\..\Source\EditForm.pas' {FmEdit}, 41 | FVCLThemeSelector in '..\..\..\Source\FVCLThemeSelector.pas' {VCLThemeSelectorForm}, 42 | DImageCollections in '..\..\Source\DImageCollections.pas' {ImageCollectionDataModule: TDataModule}, 43 | DemoAbout in '..\..\Source\DemoAbout.pas' {FrmAbout}; 44 | 45 | {$R *.res} 46 | 47 | begin 48 | Application.Initialize; 49 | Application.MainFormOnTaskbar := True; 50 | Application.Title := 'Modern App and ThemeSelector Demo with HighDPI support'; 51 | //Uses System Style for border / shadow of Forms 52 | TStyleManager.FormBorderStyle := TStyleManager.TFormBorderStyle.fbsSystemStyle; 53 | 54 | {$IFDEF STYLEDCOMPONENTS} 55 | TStyledButton.RegisterDefaultRenderingStyle(btRounded); 56 | TStyledDbNavigator.RegisterDefaultRenderingStyle(btRounded); 57 | TStyledButtonGroup.RegisterDefaultRenderingStyle(btRounded); 58 | TStyledCategoryButtons.RegisterDefaultRenderingStyle(btRounded); 59 | TStyledToolbar.RegisterDefaultRenderingStyle(btRoundRect); 60 | {$ENDIF} 61 | 62 | Application.CreateForm(TImageCollectionDataModule, ImageCollectionDataModule); 63 | Application.CreateForm(TFormMain, FormMain); 64 | Application.Run; 65 | end. 66 | -------------------------------------------------------------------------------- /Demo/Projects/D10_2/ModernAppDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_2/ModernAppDemo.res -------------------------------------------------------------------------------- /Demo/Projects/D10_2/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 27 | Vcl.Themes, 28 | Vcl.Styles; 29 | 30 | {$R *.res} 31 | 32 | begin 33 | Application.Initialize; 34 | Application.MainFormOnTaskbar := True; 35 | Application.Title := 'VCLThemeSelector Launcher'; 36 | Application.CreateForm(TLauncher, Launcher); 37 | Application.Run; 38 | end. 39 | -------------------------------------------------------------------------------- /Demo/Projects/D10_2/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_2/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/D10_3/ModernAppDemo.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020, 2024 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | program ModernAppDemo; 24 | 25 | uses 26 | Vcl.Forms, 27 | System.SysUtils, 28 | Vcl.Themes, 29 | Vcl.Styles, 30 | MidasLib, 31 | {$IFDEF STYLEDCOMPONENTS} 32 | Vcl.StyledButton, 33 | Vcl.ButtonStylesAttributes, 34 | Vcl.StyledDbNavigator, 35 | Vcl.StyledToolbar, 36 | Vcl.StyledButtonGroup, 37 | Vcl.StyledCategoryButtons, 38 | {$ENDIF} 39 | uSplitView in '..\..\Source\uSplitView.pas' {FormMain}, 40 | EditForm in '..\..\Source\EditForm.pas' {FmEdit}, 41 | FVCLThemeSelector in '..\..\..\Source\FVCLThemeSelector.pas' {VCLThemeSelectorForm}, 42 | DImageCollections in '..\..\Source\DImageCollections.pas' {ImageCollectionDataModule: TDataModule}, 43 | DemoAbout in '..\..\Source\DemoAbout.pas' {FrmAbout}; 44 | 45 | {$R *.res} 46 | 47 | begin 48 | Application.Initialize; 49 | Application.MainFormOnTaskbar := True; 50 | Application.Title := 'Modern App and ThemeSelector Demo with HighDPI support'; 51 | //Uses System Style for border / shadow of Forms 52 | TStyleManager.FormBorderStyle := TStyleManager.TFormBorderStyle.fbsSystemStyle; 53 | 54 | {$IFDEF STYLEDCOMPONENTS} 55 | TStyledButton.RegisterDefaultRenderingStyle(btRounded); 56 | TStyledDbNavigator.RegisterDefaultRenderingStyle(btRounded); 57 | TStyledButtonGroup.RegisterDefaultRenderingStyle(btRounded); 58 | TStyledCategoryButtons.RegisterDefaultRenderingStyle(btRounded); 59 | TStyledToolbar.RegisterDefaultRenderingStyle(btRoundRect); 60 | {$ENDIF} 61 | 62 | Application.CreateForm(TImageCollectionDataModule, ImageCollectionDataModule); 63 | Application.CreateForm(TFormMain, FormMain); 64 | Application.Run; 65 | end. 66 | -------------------------------------------------------------------------------- /Demo/Projects/D10_3/ModernAppDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_3/ModernAppDemo.res -------------------------------------------------------------------------------- /Demo/Projects/D10_3/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | System.SysUtils, 27 | Vcl.Themes, 28 | Vcl.Styles, 29 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}; 30 | 31 | {$R *.res} 32 | 33 | begin 34 | Application.Initialize; 35 | Application.MainFormOnTaskbar := True; 36 | Application.Title := 'VCLThemeSelector Launcher'; 37 | Application.CreateForm(TLauncher, Launcher); 38 | Application.Run; 39 | end. 40 | -------------------------------------------------------------------------------- /Demo/Projects/D10_3/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_3/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/D10_4/ModernAppDemo.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020, 2024 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | program ModernAppDemo; 24 | 25 | uses 26 | Vcl.Forms, 27 | System.SysUtils, 28 | Vcl.Themes, 29 | Vcl.Styles, 30 | MidasLib, 31 | {$IFDEF STYLEDCOMPONENTS} 32 | Vcl.StyledButton, 33 | Vcl.ButtonStylesAttributes, 34 | Vcl.StyledDbNavigator, 35 | Vcl.StyledToolbar, 36 | Vcl.StyledButtonGroup, 37 | Vcl.StyledCategoryButtons, 38 | {$ENDIF} 39 | uSplitView in '..\..\Source\uSplitView.pas' {FormMain}, 40 | EditForm in '..\..\Source\EditForm.pas' {FmEdit}, 41 | FVCLThemeSelector in '..\..\..\Source\FVCLThemeSelector.pas' {VCLThemeSelectorForm}, 42 | DImageCollections in '..\..\Source\DImageCollections.pas' {ImageCollectionDataModule: TDataModule}, 43 | DemoAbout in '..\..\Source\DemoAbout.pas' {FrmAbout}; 44 | 45 | {$R *.res} 46 | 47 | begin 48 | Application.Initialize; 49 | Application.MainFormOnTaskbar := True; 50 | Application.Title := 'Modern App and ThemeSelector Demo with HighDPI support'; 51 | //Uses System Style for border / shadow of Forms 52 | TStyleManager.FormBorderStyle := TStyleManager.TFormBorderStyle.fbsSystemStyle; 53 | 54 | {$IFDEF STYLEDCOMPONENTS} 55 | TStyledButton.RegisterDefaultRenderingStyle(btRounded); 56 | TStyledDbNavigator.RegisterDefaultRenderingStyle(btRounded); 57 | TStyledButtonGroup.RegisterDefaultRenderingStyle(btRounded); 58 | TStyledCategoryButtons.RegisterDefaultRenderingStyle(btRounded); 59 | TStyledToolbar.RegisterDefaultRenderingStyle(btRoundRect); 60 | {$ENDIF} 61 | 62 | Application.CreateForm(TImageCollectionDataModule, ImageCollectionDataModule); 63 | Application.CreateForm(TFormMain, FormMain); 64 | Application.Run; 65 | end. 66 | -------------------------------------------------------------------------------- /Demo/Projects/D10_4/ModernAppDemo.dproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | {3A641B72-3BED-4F5E-9822-B594FF4EBCDC} 4 | 19.5 5 | VCL 6 | ModernAppDemo.dpr 7 | True 8 | Release 9 | Win64 10 | 3 11 | Application 12 | 13 | 14 | true 15 | 16 | 17 | true 18 | Base 19 | true 20 | 21 | 22 | true 23 | Base 24 | true 25 | 26 | 27 | true 28 | Base 29 | true 30 | 31 | 32 | true 33 | Cfg_1 34 | true 35 | true 36 | 37 | 38 | true 39 | Cfg_1 40 | true 41 | true 42 | 43 | 44 | true 45 | Base 46 | true 47 | 48 | 49 | true 50 | Cfg_2 51 | true 52 | true 53 | 54 | 55 | "Aqua Light Slate|VCLSTYLE|$(BDSCOMMONDIR)\Styles\AquaLightSlate.vsf";CopperDark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\CopperDark.vsf;Glow|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Glow.vsf;"Iceberg Classico|VCLSTYLE|$(BDSCOMMONDIR)\Styles\IcebergClassico.vsf";"Lavender Classico|VCLSTYLE|$(BDSCOMMONDIR)\Styles\LavenderClassico.vsf";Sky|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Sky.vsf;"Slate Classico|VCLSTYLE|$(BDSCOMMONDIR)\Styles\SlateClassico.vsf";"Tablet Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\TabletDark.vsf";"Tablet Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\TabletLight.vsf";Windows10|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10.vsf;"Windows10 Blue|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Blue.vsf";"Windows10 Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Dark.vsf";"Windows10 Green|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Green.vsf";"Windows10 Purple|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Purple.vsf";"Windows10 SlateGray|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10SlateGray.vsf";"Windows11 Modern Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Dark.vsf";"Windows11 Modern Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Light.vsf" 56 | System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) 57 | ModernAppDemo 58 | .\$(Platform)\$(Config) 59 | ..\..\Bin 60 | 1033 61 | ..\..\..\Source;..\..\..\Ext\VCLStyleUtils\Common;..\..\..\Ext\VCLStyleUtils\DDetours\Source;..\..\..\..\SVGIconImageList\Source;..\..\..\..\SVGIconImageList\Image32\Source;..\..\..\..\IconFontsImageList\Source;..\..\..\..\StyledComponents\Source;$(DCC_UnitSearchPath) 62 | CompanyName=Ethea S.r.l.;FileVersion=3.3.0.0;InternalName=;LegalCopyright=Copyright (c) 2020-2024 - Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductVersion=3.3;Comments=;ProgramID=;FileDescription=;ProductName= 63 | VCLSTYLEUTILS;NO_STYLEDCOMPONENTS;$(DCC_Define) 64 | true 65 | 3 66 | 3 67 | 68 | 69 | $(BDS)\bin\default_app.manifest 70 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) 71 | ..\Ethea_vela_multires.ico 72 | PerMonitorV2 73 | true 74 | 75 | 76 | Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) 77 | Debug 78 | $(BDS)\bin\default_app.manifest 79 | ..\Ethea_vela_multires.ico 80 | PerMonitorV2 81 | true 82 | 83 | 84 | DEBUG;$(DCC_Define) 85 | true 86 | false 87 | true 88 | true 89 | true 90 | true 91 | true 92 | 93 | 94 | Debug 95 | true 96 | false 97 | true 98 | 99 | 100 | true 101 | true 102 | 103 | 104 | false 105 | RELEASE;$(DCC_Define) 106 | 0 107 | 0 108 | 109 | 110 | Debug 111 | 112 | 113 | 114 | MainSource 115 | 116 | 117 |
FormMain
118 | dfm 119 |
120 | 121 |
FmEdit
122 | dfm 123 |
124 | 125 |
VCLThemeSelectorForm
126 | dfm 127 |
128 | 129 |
ImageCollectionDataModule
130 | dfm 131 | TDataModule 132 |
133 | 134 |
FrmAbout
135 |
136 | 137 | Base 138 | 139 | 140 | Cfg_1 141 | Base 142 | 143 | 144 | Cfg_2 145 | Base 146 | 147 |
148 | 149 | Delphi.Personality.12 150 | Application 151 | 152 | 153 | 154 | 155 | ModernAppDemo.dpr 156 | 157 | 158 | 159 | True 160 | True 161 | 162 | 163 | 12 164 | 165 | 166 | 167 |
168 | -------------------------------------------------------------------------------- /Demo/Projects/D10_4/ModernAppDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_4/ModernAppDemo.res -------------------------------------------------------------------------------- /Demo/Projects/D10_4/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | System.SysUtils, 27 | Vcl.Themes, 28 | Vcl.Styles, 29 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 30 | CBVCLStylePreviewForm in '..\..\..\Source\CBVCLStylePreviewForm.pas' {CBVCLPreviewForm: TFrame}; 31 | 32 | {$R *.res} 33 | 34 | begin 35 | Application.Initialize; 36 | Application.MainFormOnTaskbar := True; 37 | Application.Title := 'VCLThemeSelector Launcher'; 38 | Application.CreateForm(TLauncher, Launcher); 39 | Application.Run; 40 | end. 41 | -------------------------------------------------------------------------------- /Demo/Projects/D10_4/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D10_4/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/D11/ModernAppDemo.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020, 2023 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | program ModernAppDemo; 24 | 25 | uses 26 | Vcl.Forms, 27 | System.SysUtils, 28 | Vcl.Themes, 29 | Vcl.Styles, 30 | MidasLib, 31 | {$IFDEF STYLEDCOMPONENTS} 32 | Vcl.StyledButton, 33 | Vcl.ButtonStylesAttributes, 34 | Vcl.StyledDbNavigator, 35 | Vcl.StyledToolbar, 36 | Vcl.StyledButtonGroup, 37 | Vcl.StyledCategoryButtons, 38 | {$ENDIF} 39 | uSplitView in '..\..\Source\uSplitView.pas' {FormMain}, 40 | EditForm in '..\..\Source\EditForm.pas' {FmEdit}, 41 | FVCLThemeSelector in '..\..\..\Source\FVCLThemeSelector.pas' {VCLThemeSelectorForm}, 42 | DImageCollections in '..\..\Source\DImageCollections.pas' {ImageCollectionDataModule: TDataModule}, 43 | DemoAbout in '..\..\Source\DemoAbout.pas' {FrmAbout}; 44 | 45 | {$R *.res} 46 | 47 | begin 48 | Application.Initialize; 49 | Application.MainFormOnTaskbar := True; 50 | Application.Title := 'Modern App and ThemeSelector Demo with HighDPI support'; 51 | //Uses System Style for border / shadow of Forms 52 | TStyleManager.FormBorderStyle := TStyleManager.TFormBorderStyle.fbsSystemStyle; 53 | 54 | {$IFDEF STYLEDCOMPONENTS} 55 | TStyledButton.RegisterDefaultRenderingStyle(btRounded); 56 | TStyledDbNavigator.RegisterDefaultRenderingStyle(btRounded); 57 | TStyledButtonGroup.RegisterDefaultRenderingStyle(btRounded); 58 | TStyledCategoryButtons.RegisterDefaultRenderingStyle(btRounded); 59 | TStyledToolbar.RegisterDefaultRenderingStyle(btRoundRect); 60 | {$ENDIF} 61 | 62 | Application.CreateForm(TImageCollectionDataModule, ImageCollectionDataModule); 63 | Application.CreateForm(TFormMain, FormMain); 64 | Application.Run; 65 | end. 66 | -------------------------------------------------------------------------------- /Demo/Projects/D11/ModernAppDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D11/ModernAppDemo.res -------------------------------------------------------------------------------- /Demo/Projects/D11/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | System.SysUtils, 27 | Vcl.Themes, 28 | Vcl.Styles, 29 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 30 | CBVCLStylePreviewForm in '..\..\..\Source\CBVCLStylePreviewForm.pas' {CBVCLPreviewForm: TFrame}; 31 | 32 | {$R *.res} 33 | 34 | begin 35 | Application.Initialize; 36 | Application.MainFormOnTaskbar := True; 37 | Application.Title := 'VCLThemeSelector Launcher'; 38 | Application.CreateForm(TLauncher, Launcher); 39 | Application.Run; 40 | end. 41 | -------------------------------------------------------------------------------- /Demo/Projects/D11/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D11/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/D12/ModernAppDemo.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020, 2023 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | program ModernAppDemo; 24 | 25 | uses 26 | Vcl.Forms, 27 | System.SysUtils, 28 | Vcl.Themes, 29 | Vcl.Styles, 30 | MidasLib, 31 | {$IFDEF STYLEDCOMPONENTS} 32 | Vcl.StyledButton, 33 | Vcl.ButtonStylesAttributes, 34 | Vcl.StyledDbNavigator, 35 | Vcl.StyledToolbar, 36 | Vcl.StyledButtonGroup, 37 | Vcl.StyledCategoryButtons, 38 | {$ENDIF} 39 | uSplitView in '..\..\Source\uSplitView.pas' {FormMain}, 40 | EditForm in '..\..\Source\EditForm.pas' {FmEdit}, 41 | FVCLThemeSelector in '..\..\..\Source\FVCLThemeSelector.pas' {VCLThemeSelectorForm}, 42 | DImageCollections in '..\..\Source\DImageCollections.pas' {ImageCollectionDataModule: TDataModule}, 43 | DemoAbout in '..\..\Source\DemoAbout.pas' {FrmAbout}; 44 | 45 | {$R *.res} 46 | 47 | begin 48 | Application.Initialize; 49 | Application.MainFormOnTaskbar := True; 50 | Application.Title := 'Modern App and ThemeSelector Demo with HighDPI support'; 51 | //Uses System Style for border / shadow of Forms 52 | TStyleManager.FormBorderStyle := TStyleManager.TFormBorderStyle.fbsSystemStyle; 53 | 54 | {$IFDEF STYLEDCOMPONENTS} 55 | TStyledButton.RegisterDefaultRenderingStyle(btRounded); 56 | TStyledDbNavigator.RegisterDefaultRenderingStyle(btRounded); 57 | TStyledButtonGroup.RegisterDefaultRenderingStyle(btRounded); 58 | TStyledCategoryButtons.RegisterDefaultRenderingStyle(btRounded); 59 | TStyledToolbar.RegisterDefaultRenderingStyle(btRoundRect); 60 | {$ENDIF} 61 | 62 | Application.CreateForm(TImageCollectionDataModule, ImageCollectionDataModule); 63 | Application.CreateForm(TFormMain, FormMain); 64 | Application.Run; 65 | end. 66 | -------------------------------------------------------------------------------- /Demo/Projects/D12/ModernAppDemo.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D12/ModernAppDemo.res -------------------------------------------------------------------------------- /Demo/Projects/D12/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | System.SysUtils, 27 | Vcl.Themes, 28 | Vcl.Styles, 29 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 30 | CBVCLStylePreviewForm in '..\..\..\Source\CBVCLStylePreviewForm.pas' {CBVCLPreviewForm: TFrame}; 31 | 32 | {$R *.res} 33 | 34 | begin 35 | Application.Initialize; 36 | Application.MainFormOnTaskbar := True; 37 | Application.Title := 'VCLThemeSelector Launcher'; 38 | Application.CreateForm(TLauncher, Launcher); 39 | Application.Run; 40 | end. 41 | -------------------------------------------------------------------------------- /Demo/Projects/D12/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/D12/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/DXE3/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 27 | Vcl.Themes, 28 | Vcl.Styles; 29 | 30 | {$R *.res} 31 | 32 | begin 33 | Application.Initialize; 34 | Application.MainFormOnTaskbar := True; 35 | Application.Title := 'VCLThemeSelector Launcher'; 36 | Application.CreateForm(TLauncher, Launcher); 37 | Application.Run; 38 | end. 39 | -------------------------------------------------------------------------------- /Demo/Projects/DXE3/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/DXE3/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/DXE6/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 27 | Vcl.Themes, 28 | Vcl.Styles; 29 | 30 | {$R *.res} 31 | 32 | begin 33 | Application.Initialize; 34 | Application.MainFormOnTaskbar := True; 35 | Application.Title := 'VCLThemeSelector Launcher'; 36 | Application.CreateForm(TLauncher, Launcher); 37 | Application.Run; 38 | end. 39 | -------------------------------------------------------------------------------- /Demo/Projects/DXE6/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/DXE6/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/DXE8/VCLThemeSelectorLauncher.dpr: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | program VCLThemeSelectorLauncher; 23 | 24 | uses 25 | Vcl.Forms, 26 | LauncherForm in '..\..\Source\LauncherForm.pas' {Launcher}, 27 | Vcl.Themes, 28 | Vcl.Styles; 29 | 30 | {$R *.res} 31 | 32 | begin 33 | Application.Initialize; 34 | Application.MainFormOnTaskbar := True; 35 | Application.Title := 'VCLThemeSelector Launcher'; 36 | Application.CreateForm(TLauncher, Launcher); 37 | Application.Run; 38 | end. 39 | -------------------------------------------------------------------------------- /Demo/Projects/DXE8/VCLThemeSelectorLauncher.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/DXE8/VCLThemeSelectorLauncher.res -------------------------------------------------------------------------------- /Demo/Projects/Ethea_vela_multires.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Demo/Projects/Ethea_vela_multires.ico -------------------------------------------------------------------------------- /Demo/Source/DImageCollections.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020-2024 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | unit DImageCollections; 24 | 25 | interface 26 | 27 | uses 28 | System.SysUtils, System.Classes, IconFontsImageCollection, 29 | Vcl.BaseImageCollection, //If you are compiling with a versione older than 10.3 remove this line 30 | SVGIconImageCollection; 31 | 32 | type 33 | TIconsType = (itIconFonts, itSVGIcons); 34 | 35 | TImageCollectionDataModule = class(TDataModule) 36 | SVGIconImageCollection: TSVGIconImageCollection; 37 | IconFontsImageCollection: TIconFontsImageCollection; 38 | IconFontsImageCollectionMono: TIconFontsImageCollection; 39 | private 40 | FIconsType: TIconsType; 41 | procedure SetIconsType(const Value: TIconsType); 42 | public 43 | property IconsType: TIconsType read FIconsType write SetIconsType; 44 | end; 45 | 46 | var 47 | ImageCollectionDataModule: TImageCollectionDataModule; 48 | 49 | implementation 50 | 51 | {$R *.dfm} 52 | 53 | { TImageCollectionDataModule } 54 | 55 | procedure TImageCollectionDataModule.SetIconsType(const Value: TIconsType); 56 | begin 57 | FIconsType := Value; 58 | end; 59 | 60 | end. 61 | -------------------------------------------------------------------------------- /Demo/Source/DemoAbout.dfm: -------------------------------------------------------------------------------- 1 | object FrmAbout: TFrmAbout 2 | Left = 651 3 | Top = 323 4 | BorderIcons = [biSystemMenu] 5 | BorderStyle = bsSingle 6 | ClientHeight = 311 7 | ClientWidth = 427 8 | Color = clBtnFace 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -11 12 | Font.Name = 'Segoe UI' 13 | Font.Style = [] 14 | Position = poMainFormCenter 15 | OnClose = FormClose 16 | OnCreate = FormCreate 17 | DesignSize = ( 18 | 427 19 | 311) 20 | TextHeight = 13 21 | object TitleLabel: TLabel 22 | Left = 190 23 | Top = 8 24 | Width = 229 25 | Height = 89 26 | AutoSize = False 27 | Caption = 'Modern App Demo' 28 | WordWrap = True 29 | end 30 | object SVGIconImage2: TSVGIconImage 31 | Left = 9 32 | Top = 3 33 | Width = 175 34 | Height = 53 35 | AutoSize = False 36 | SVGText = 37 | ''#13#10''#13#10' '#13#10' '#13#10' '#13#10'' + 102 | #13#10 103 | end 104 | object Panel1: TPanel 105 | Left = 0 106 | Top = 260 107 | Width = 427 108 | Height = 51 109 | Align = alBottom 110 | BevelOuter = bvNone 111 | Color = clWindow 112 | ParentBackground = False 113 | TabOrder = 0 114 | object btnOK: TButton 115 | Left = 267 116 | Top = 16 117 | Width = 75 118 | Height = 25 119 | Caption = 'CLOSE' 120 | Default = True 121 | TabOrder = 0 122 | OnClick = btnOKClick 123 | end 124 | object ButtonHelp: TButton 125 | Left = 348 126 | Top = 16 127 | Width = 75 128 | Height = 25 129 | Caption = 'HELP' 130 | TabOrder = 1 131 | OnClick = ButtonHelpClick 132 | end 133 | end 134 | object MemoCopyRights: TMemo 135 | Left = 8 136 | Top = 108 137 | Width = 414 138 | Height = 146 139 | Anchors = [akLeft, akTop, akBottom] 140 | Color = clBtnFace 141 | Lines.Strings = ( 142 | 'Author:' 143 | 'Carlo Barazzetta' 144 | 'https://github.com/EtheaDev/VCLThemeSelector' 145 | 'Copyright '#169' 2022-2024 all rights reserved.' 146 | '' 147 | 'License: this Demo is inspired by TSplitView demo' 148 | 149 | '(original software is Copyright (c) 2015 Embarcadero Technologie' + 150 | 's, Inc.)' 151 | 'and is released under Apache 2.0 license') 152 | ReadOnly = True 153 | ScrollBars = ssVertical 154 | TabOrder = 1 155 | end 156 | end 157 | -------------------------------------------------------------------------------- /Demo/Source/DemoAbout.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { } 3 | { Markdown Help Viewer: Demo About Form } 4 | { (Help Viewer and Help Interfaces for Markdown files) } 5 | { } 6 | { Copyright (c) 2023-2024 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { } 9 | { https://github.com/EtheaDev/MarkdownHelpViewer } 10 | { } 11 | {******************************************************************************} 12 | { } 13 | { Licensed under the Apache License, Version 2.0 (the "License"); } 14 | { you may not use this file except in compliance with the License. } 15 | { You may obtain a copy of the License at } 16 | { } 17 | { http://www.apache.org/licenses/LICENSE-2.0 } 18 | { } 19 | { Unless required by applicable law or agreed to in writing, software } 20 | { distributed under the License is distributed on an "AS IS" BASIS, } 21 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 22 | { See the License for the specific language governing permissions and } 23 | { limitations under the License. } 24 | { } 25 | {******************************************************************************} 26 | unit DemoAbout; 27 | 28 | interface 29 | 30 | uses 31 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, 32 | StdCtrls, ExtCtrls, 33 | {$IFDEF STYLEDCOMPONENTS}Vcl.StyledComponentsHooks,{$ENDIF} 34 | SVGIconImage; 35 | 36 | const 37 | HELP_URL = 'https://github.com/EtheaDev/VCLThemeSelector'; 38 | type 39 | TFrmAbout = class(TForm) 40 | Panel1: TPanel; 41 | btnOK: TButton; 42 | TitleLabel: TLabel; 43 | MemoCopyRights: TMemo; 44 | ButtonHelp: TButton; 45 | SVGIconImage2: TSVGIconImage; 46 | procedure btnOKClick(Sender: TObject); 47 | procedure FormCreate(Sender: TObject); 48 | procedure FormClose(Sender: TObject; var Action: TCloseAction); 49 | procedure ButtonHelpClick(Sender: TObject); 50 | private 51 | FTitle: string; 52 | procedure SetTitle(const Value: string); 53 | public 54 | property Title: string read FTitle write SetTitle; 55 | end; 56 | 57 | procedure ShowAboutForm(const ATitle: string); 58 | 59 | implementation 60 | 61 | uses 62 | ShellApi; 63 | 64 | {$R *.dfm} 65 | 66 | procedure ShowAboutForm(const ATitle: string); 67 | var 68 | LFrm: TFrmAbout; 69 | begin 70 | LFrm := TFrmAbout.Create(nil); 71 | try 72 | LFrm.Title := ATitle; 73 | LFrm.ShowModal; 74 | finally 75 | LFrm.Free; 76 | end; 77 | end; 78 | 79 | procedure TFrmAbout.btnOKClick(Sender: TObject); 80 | begin 81 | Close(); 82 | end; 83 | 84 | procedure TFrmAbout.ButtonHelpClick(Sender: TObject); 85 | begin 86 | ShellExecute(Handle, 'open', PChar(HELP_URL), nil, nil, SW_SHOW); 87 | end; 88 | 89 | procedure TFrmAbout.FormClose(Sender: TObject; var Action: TCloseAction); 90 | begin 91 | Action := caFree; 92 | end; 93 | 94 | procedure TFrmAbout.FormCreate(Sender: TObject); 95 | begin 96 | TitleLabel.Font.Height := Round(TitleLabel.Font.Height * 1.6); 97 | end; 98 | 99 | procedure TFrmAbout.SetTitle(const Value: string); 100 | begin 101 | FTitle := Value; 102 | Caption := FTitle; 103 | TitleLabel.Caption := Value; 104 | end; 105 | 106 | end. 107 | -------------------------------------------------------------------------------- /Demo/Source/EditForm.dfm: -------------------------------------------------------------------------------- 1 | object FmEdit: TFmEdit 2 | Left = 0 3 | Top = 0 4 | Caption = 'Edit Form' 5 | ClientHeight = 299 6 | ClientWidth = 635 7 | Color = clBtnFace 8 | ParentFont = True 9 | Menu = MainMenu 10 | ShowHint = True 11 | OnAfterMonitorDpiChanged = FormAfterMonitorDpiChanged 12 | OnClose = FormClose 13 | OnShow = FormShow 14 | TextHeight = 15 15 | object PageControl1: TPageControl 16 | Left = 0 17 | Top = 29 18 | Width = 635 19 | Height = 270 20 | ActivePage = tsParentFont 21 | Align = alClient 22 | TabOrder = 0 23 | object tsParentFont: TTabSheet 24 | Caption = 'Parent Font = True' 25 | object Label1: TLabel 26 | Left = 8 27 | Top = 7 28 | Width = 32 29 | Height = 15 30 | Caption = 'Name' 31 | end 32 | object Label2: TLabel 33 | Left = 271 34 | Top = 7 35 | Width = 47 36 | Height = 15 37 | Caption = 'Surname' 38 | end 39 | object NameEdit: TEdit 40 | Left = 8 41 | Top = 24 42 | Width = 257 43 | Height = 33 44 | Hint = 'Name' 45 | TabOrder = 0 46 | Text = 'Barazzetta' 47 | end 48 | object SurNameEdit: TEdit 49 | Left = 271 50 | Top = 24 51 | Width = 257 52 | Height = 33 53 | Hint = 'SurName' 54 | TabOrder = 1 55 | Text = 'Carlo' 56 | end 57 | object LabeledEdit: TLabeledEdit 58 | Left = 8 59 | Top = 72 60 | Width = 257 61 | Height = 33 62 | EditLabel.Width = 64 63 | EditLabel.Height = 15 64 | EditLabel.Caption = 'Labeled Edit' 65 | TabOrder = 2 66 | Text = 'Text' 67 | end 68 | end 69 | object tsNoParent: TTabSheet 70 | Caption = 'Parent Font = False' 71 | Font.Charset = DEFAULT_CHARSET 72 | Font.Color = clWindowText 73 | Font.Height = -11 74 | Font.Name = 'Tahoma' 75 | Font.Style = [] 76 | ImageIndex = 1 77 | ParentFont = False 78 | object Label3: TLabel 79 | Left = 12 80 | Top = 11 81 | Width = 27 82 | Height = 13 83 | Caption = 'Name' 84 | end 85 | object Label4: TLabel 86 | Left = 275 87 | Top = 11 88 | Width = 42 89 | Height = 13 90 | Caption = 'Surname' 91 | end 92 | object Edit1: TEdit 93 | Left = 12 94 | Top = 28 95 | Width = 257 96 | Height = 21 97 | Font.Charset = DEFAULT_CHARSET 98 | Font.Color = clWindowText 99 | Font.Height = -11 100 | Font.Name = 'Tahoma' 101 | Font.Style = [fsBold] 102 | ParentFont = False 103 | TabOrder = 0 104 | Text = 'Barazzetta' 105 | end 106 | object Edit2: TEdit 107 | Left = 275 108 | Top = 28 109 | Width = 257 110 | Height = 21 111 | Font.Charset = DEFAULT_CHARSET 112 | Font.Color = clWindowText 113 | Font.Height = -11 114 | Font.Name = 'Tahoma' 115 | Font.Style = [fsBold] 116 | ParentFont = False 117 | TabOrder = 1 118 | Text = 'Carlo' 119 | end 120 | object LabeledEdit2: TLabeledEdit 121 | Left = 12 122 | Top = 76 123 | Width = 257 124 | Height = 21 125 | EditLabel.Width = 58 126 | EditLabel.Height = 13 127 | EditLabel.Caption = 'Labeled Edit' 128 | Font.Charset = DEFAULT_CHARSET 129 | Font.Color = clWindowText 130 | Font.Height = -11 131 | Font.Name = 'Tahoma' 132 | Font.Style = [fsBold] 133 | ParentFont = False 134 | TabOrder = 2 135 | Text = 'Text' 136 | end 137 | end 138 | end 139 | object ToolBar1: TToolBar 140 | Left = 0 141 | Top = 0 142 | Width = 635 143 | Height = 29 144 | ButtonHeight = 30 145 | ButtonWidth = 31 146 | Caption = 'ToolBar' 147 | Images = IconFontsVirtualImageList 148 | TabOrder = 1 149 | object ToolButton1: TToolButton 150 | Left = 0 151 | Top = 0 152 | Caption = 'ToolButton1' 153 | ImageIndex = 5 154 | ImageName = 'home' 155 | end 156 | object ToolButton2: TToolButton 157 | Left = 31 158 | Top = 0 159 | Caption = 'ToolButton2' 160 | ImageIndex = 20 161 | ImageName = 'exit' 162 | OnClick = Exit1Click 163 | end 164 | end 165 | object MainMenu: TMainMenu 166 | Images = IconFontsVirtualImageList 167 | Left = 312 168 | Top = 152 169 | object File1: TMenuItem 170 | Caption = '&File' 171 | object SettingsMenuitem: TMenuItem 172 | Caption = '&New' 173 | ImageIndex = 13 174 | ImageName = 'check-bold' 175 | end 176 | object Open1: TMenuItem 177 | Caption = '&Open...' 178 | ImageIndex = 4 179 | ImageName = 'checkbox-marked' 180 | end 181 | object Save1: TMenuItem 182 | Caption = '&Save' 183 | ImageIndex = 2 184 | ImageName = 'cake-variant' 185 | end 186 | object SaveAs1: TMenuItem 187 | Caption = 'Save &As...' 188 | ImageIndex = 3 189 | ImageName = 'layers' 190 | end 191 | object N2: TMenuItem 192 | Caption = '-' 193 | end 194 | object Print1: TMenuItem 195 | Caption = '&Print...' 196 | ImageIndex = 4 197 | ImageName = 'checkbox-marked' 198 | end 199 | object PrintSetup1: TMenuItem 200 | Caption = 'P&rint Setup...' 201 | ImageIndex = 5 202 | ImageName = 'home' 203 | end 204 | object N1: TMenuItem 205 | Caption = '-' 206 | end 207 | object Exit1: TMenuItem 208 | Caption = 'E&xit' 209 | ImageIndex = 20 210 | ImageName = 'exit' 211 | OnClick = Exit1Click 212 | end 213 | end 214 | end 215 | object IconFontsVirtualImageList: TIconFontsVirtualImageList 216 | FontName = 'Material Design Icons Desktop' 217 | Size = 24 218 | ImageCollection = ImageCollectionDataModule.IconFontsImageCollectionMono 219 | Left = 416 220 | Top = 152 221 | end 222 | object SVGIconVirtualImageList: TSVGIconVirtualImageList 223 | ImageCollection = ImageCollectionDataModule.SVGIconImageCollection 224 | Width = 24 225 | Height = 24 226 | Size = 24 227 | Left = 416 228 | Top = 208 229 | end 230 | end 231 | -------------------------------------------------------------------------------- /Demo/Source/EditForm.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { ModernAppDemo by Carlo Barazzetta } 3 | { A full example of an HighDPI - VCL Themed enabled application } 4 | { See how to select the application Theme using VCLThemeSelector Form } 5 | { } 6 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 7 | { Author: Carlo Barazzetta } 8 | { https://github.com/EtheaDev/VCLThemeSelector } 9 | { } 10 | { Licensed under the Apache License, Version 2.0 (the "License"); } 11 | { you may not use this file except in compliance with the License. } 12 | { You may obtain a copy of the License at } 13 | { } 14 | { http://www.apache.org/licenses/LICENSE-2.0 } 15 | { } 16 | { Unless required by applicable law or agreed to in writing, software } 17 | { distributed under the License is distributed on an "AS IS" BASIS, } 18 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 19 | { See the License for the specific language governing permissions and } 20 | { limitations under the License. } 21 | { } 22 | {******************************************************************************} 23 | unit EditForm; 24 | 25 | interface 26 | 27 | uses 28 | Winapi.Windows 29 | , Winapi.Messages 30 | , System.SysUtils 31 | , System.Variants 32 | , System.Classes 33 | , Vcl.Graphics 34 | , Vcl.Controls 35 | , Vcl.Forms 36 | , Vcl.Dialogs 37 | , Vcl.Mask 38 | , Vcl.DBCtrls 39 | , Vcl.StdCtrls 40 | , Vcl.ExtCtrls 41 | , Vcl.ComCtrls 42 | , Vcl.Menus 43 | , System.ImageList 44 | , Vcl.ImgList 45 | , SVGIconImageListBase //If don't compile you must before download and installa SVGIconImageList components 46 | , SVGIconVirtualImageList //https://github.com/EtheaDev/SVGIconImageList 47 | , IconFontsImageListBase //If don't compile you must before download and installa IconFontsImageList components 48 | , IconFontsVirtualImageList //https://github.com/EtheaDev/IconFontsImageList 49 | , DImageCollections, Vcl.ToolWin 50 | {$IFDEF STYLEDCOMPONENTS} 51 | , Vcl.StyledComponentsHooks 52 | {$ENDIF} 53 | ; 54 | 55 | type 56 | TFmEdit = class(TForm) 57 | PageControl1: TPageControl; 58 | tsParentFont: TTabSheet; 59 | NameEdit: TEdit; 60 | SurNameEdit: TEdit; 61 | LabeledEdit: TLabeledEdit; 62 | Label1: TLabel; 63 | Label2: TLabel; 64 | tsNoParent: TTabSheet; 65 | Label3: TLabel; 66 | Label4: TLabel; 67 | Edit1: TEdit; 68 | Edit2: TEdit; 69 | LabeledEdit2: TLabeledEdit; 70 | MainMenu: TMainMenu; 71 | File1: TMenuItem; 72 | SettingsMenuitem: TMenuItem; 73 | Open1: TMenuItem; 74 | Save1: TMenuItem; 75 | SaveAs1: TMenuItem; 76 | Print1: TMenuItem; 77 | PrintSetup1: TMenuItem; 78 | Exit1: TMenuItem; 79 | N1: TMenuItem; 80 | N2: TMenuItem; 81 | IconFontsVirtualImageList: TIconFontsVirtualImageList; 82 | SVGIconVirtualImageList: TSVGIconVirtualImageList; 83 | ToolBar1: TToolBar; 84 | ToolButton1: TToolButton; 85 | ToolButton2: TToolButton; 86 | procedure FormClose(Sender: TObject; var Action: TCloseAction); 87 | procedure FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, 88 | NewDPI: Integer); 89 | procedure FormShow(Sender: TObject); 90 | procedure Exit1Click(Sender: TObject); 91 | private 92 | procedure UpdateFontAttributes; 93 | protected 94 | public 95 | end; 96 | 97 | var 98 | FmEdit: TFmEdit; 99 | 100 | implementation 101 | 102 | {$R *.dfm} 103 | 104 | procedure TFmEdit.Exit1Click(Sender: TObject); 105 | begin 106 | Close; 107 | end; 108 | 109 | procedure TFmEdit.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, 110 | NewDPI: Integer); 111 | begin 112 | if ParentFont and (Application.MainForm.Monitor.Handle <> Self.Monitor.Handle) then 113 | Font.Height := MulDiv(Font.Height, NewDPI, OldDPI); 114 | end; 115 | 116 | procedure TFmEdit.FormClose(Sender: TObject; var Action: TCloseAction); 117 | begin 118 | Action := caFree; 119 | FmEdit := nil; 120 | end; 121 | 122 | procedure TFmEdit.FormShow(Sender: TObject); 123 | begin 124 | if ImageCollectionDataModule.IconsType = itIconFonts then 125 | FmEdit.MainMenu.Images := IconFontsVirtualImageList 126 | else 127 | FmEdit.MainMenu.Images := SVGIconVirtualImageList; 128 | UpdateFontAttributes; 129 | end; 130 | 131 | procedure TFmEdit.UpdateFontAttributes; 132 | begin 133 | NameEdit.ParentFont := True; 134 | NameEdit.Font.Style := [fsBold]; 135 | SurNameEdit.ParentFont := True; 136 | SurNameEdit.Font.Style := [fsBold]; 137 | LabeledEdit.ParentFont := True; 138 | LabeledEdit.Font.Style := [fsBold]; 139 | end; 140 | 141 | end. 142 | -------------------------------------------------------------------------------- /Demo/Source/LauncherForm.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { VCLThemeSelector Launcher by Carlo Barazzetta } 3 | { A simple example to launch VCLThemeSelector } 4 | { } 5 | { Copyright (c) 2020-2023 (Ethea S.r.l.) } 6 | { Author: Carlo Barazzetta } 7 | { https://github.com/EtheaDev/VCLThemeSelector } 8 | { } 9 | { Licensed under the Apache License, Version 2.0 (the "License"); } 10 | { you may not use this file except in compliance with the License. } 11 | { You may obtain a copy of the License at } 12 | { } 13 | { http://www.apache.org/licenses/LICENSE-2.0 } 14 | { } 15 | { Unless required by applicable law or agreed to in writing, software } 16 | { distributed under the License is distributed on an "AS IS" BASIS, } 17 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 18 | { See the License for the specific language governing permissions and } 19 | { limitations under the License. } 20 | { } 21 | {******************************************************************************} 22 | unit LauncherForm; 23 | 24 | interface 25 | 26 | uses 27 | Winapi.Windows 28 | , Winapi.Messages 29 | , System.SysUtils 30 | , System.Variants 31 | , System.Classes 32 | , Vcl.Graphics 33 | , Vcl.Controls 34 | , Vcl.Forms 35 | , Vcl.Dialogs 36 | , Vcl.StdCtrls 37 | , Vcl.ExtCtrls 38 | , Vcl.Themes 39 | , Vcl.Imaging.pngimage 40 | , Vcl.Mask; 41 | 42 | const 43 | COMPANY_NAME = 'Ethea'; 44 | 45 | type 46 | TLauncher = class(TForm) 47 | ChangeThemeButton: TButton; 48 | ExcludeWindowsCkeckBox: TCheckBox; 49 | MaxRowsEdit: TLabeledEdit; 50 | MaxColsEdit: TLabeledEdit; 51 | EtheaImage: TImage; 52 | Label1: TLabel; 53 | Label2: TLabel; 54 | procedure ChangeThemeButtonClick(Sender: TObject); 55 | private 56 | procedure TrySetStyle(const AStyleName: string); 57 | protected 58 | procedure Loaded; override; 59 | public 60 | { Public declarations } 61 | end; 62 | 63 | var 64 | Launcher: TLauncher; 65 | 66 | implementation 67 | 68 | {$R *.dfm} 69 | 70 | uses 71 | FVCLThemeSelector 72 | ; 73 | 74 | procedure TLauncher.TrySetStyle(const AStyleName: string); 75 | begin 76 | try 77 | TStyleManager.SetStyle(AStyleName); 78 | except 79 | ; //ignore 80 | end; 81 | end; 82 | 83 | procedure TLauncher.ChangeThemeButtonClick(Sender: TObject); 84 | var 85 | LStyleName: string; 86 | begin 87 | LStyleName := TStyleManager.ActiveStyle.Name; 88 | 89 | if ShowVCLThemeSelector(LStyleName, 90 | ExcludeWindowsCkeckBox.Checked, 91 | StrToInt(MaxRowsEdit.Text), 92 | StrToInt(MaxColsEdit.Text)) then 93 | begin 94 | TrySetStyle(LStyleName); 95 | WriteAppStyleToReg(COMPANY_NAME, ExtractFileName(Application.ExeName), LStyleName); 96 | end; 97 | end; 98 | 99 | procedure TLauncher.Loaded; 100 | var 101 | LStyleName: string; 102 | begin 103 | //Acquire system font and size (eg. for windows 10 Segoe UI and 14 at 96 DPI) 104 | //but without using Assign! 105 | Font.Name := Screen.IconFont.Name; 106 | //If you want to use system font Height: 107 | Font.Height := Muldiv(Screen.IconFont.Height, 96, Screen.IconFont.PixelsPerInch); 108 | 109 | //Read Style stored into Registry 110 | LStyleName := ReadAppStyleFromReg(COMPANY_NAME, ExtractFileName(Application.ExeName)); 111 | TrySetStyle(LStyleName); 112 | 113 | inherited; 114 | end; 115 | 116 | initialization 117 | //Example: how to add a new style not present into VCLThemeSelectorLauncher.InitDefaultThemesAttributes 118 | //download 'Radiant VCL Premium Style' from GetIt Package Manager and add to the 119 | //appearance section of this application 120 | RegisterThemeAttributes('Radiant', ttLight, clWebLightYellow, clWebLightgrey); 121 | 122 | end. 123 | -------------------------------------------------------------------------------- /Doc/Delphi Live 2020-04-29.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Doc/Delphi Live 2020-04-29.pdf -------------------------------------------------------------------------------- /Doc/Delphi-Developers-Guide-4K.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Doc/Delphi-Developers-Guide-4K.pdf -------------------------------------------------------------------------------- /Doc/Delphi_Day_2020_Modernizzare_App_VCL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Doc/Delphi_Day_2020_Modernizzare_App_VCL.pdf -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/AwesomeFont.RC: -------------------------------------------------------------------------------- 1 | fontawesome RCDATA fontawesome.ttf -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/AwesomeFont.RES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Ext/VCLStyleUtils/Common/AwesomeFont.RES -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/AwesomeFont_zip.RC: -------------------------------------------------------------------------------- 1 | fontawesome_zip RCDATA fontawesome.zip -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/AwesomeFont_zip.RES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Ext/VCLStyleUtils/Common/AwesomeFont_zip.RES -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/CompileResources.bat: -------------------------------------------------------------------------------- 1 | "C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\brcc32.exe" AwesomeFont.rc 2 | Pause -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/CompileResources_zip.bat: -------------------------------------------------------------------------------- 1 | "C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\brcc32.exe" AwesomeFont_zip.rc 2 | Pause -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/VCL.Styles.Utils.inc: -------------------------------------------------------------------------------- 1 | //************************************************************************************************** 2 | // 3 | // Vcl.Styles.Utils.inc 4 | // file for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // 16 | // Portions created by Mahdi Safsafi [SMP3] e-mail SMP@LIVE.FR 17 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2013-2023 Rodrigo Ruz V. 18 | // All Rights Reserved. 19 | // 20 | //************************************************************************************************ 21 | {$DEFINE USE_Vcl.Styles.Hooks} 22 | {$DEFINE HOOK_UXTHEME} 23 | {$DEFINE HOOK_TDateTimePicker} 24 | {$DEFINE HOOK_TProgressBar} 25 | {.$DEFINE LimitStylesToMainApplicationThread} 26 | {.$DEFINE HOOK_VirtualShell} 27 | {.$DEFINE HOOK_ExplorerStatusBar} 28 | { Feature toggles for supported UxThemes - see Vcl.Styles.UxTheme } 29 | {$DEFINE HOOK_Button} 30 | {$DEFINE HOOK_AllButtons} 31 | {$DEFINE HOOK_Scrollbar} 32 | {$DEFINE HOOK_TaskDialog} 33 | {$DEFINE HOOK_ProgressBar} 34 | {$DEFINE HOOK_DateTimePicker} 35 | {$DEFINE HOOK_TreeView} 36 | {$DEFINE HOOK_ListView} 37 | {$DEFINE HOOK_ListBox} 38 | {$DEFINE HOOK_ComboBox} 39 | 40 | {$DEFINE HOOK_Spin} 41 | {$DEFINE HOOK_EDIT} 42 | {$DEFINE HOOK_Rebar} 43 | {$DEFINE HOOK_ToolBar} 44 | {$DEFINE HOOK_Menu} 45 | {$DEFINE HOOK_TrackBar} 46 | {$DEFINE HOOK_ToolTip} 47 | {$DEFINE HOOK_Tab} 48 | // Introduced in Windows Vista 49 | {$DEFINE HOOK_CommandModule} 50 | {$DEFINE HOOK_SearchBox} 51 | {$DEFINE HOOK_AddressBand} 52 | {$DEFINE HOOK_PreviewPane} 53 | {$DEFINE HOOK_TRYHARDER} 54 | {$DEFINE HOOK_BREADCRUMBAR} 55 | {$DEFINE HOOK_InfoBar} 56 | // Introduced in Windows 8 57 | {$DEFINE HOOK_Navigation} 58 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.ControlColor.pas: -------------------------------------------------------------------------------- 1 | //************************************************************************************************** 2 | // 3 | // Unit Vcl.Styles.ControlColor 4 | // unit for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // The Original Code is Vcl.Styles.ControlColor 16 | // 17 | // The Initial Developer of the Original Code is Rodrigo Ruz V. 18 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2023 Rodrigo Ruz V. 19 | // All Rights Reserved. 20 | // 21 | //************************************************************************************************** 22 | unit Vcl.Styles.ControlColor; 23 | 24 | interface 25 | 26 | uses 27 | Vcl.StdCtrls, 28 | Vcl.Controls, 29 | Winapi.Messages; 30 | 31 | type 32 | /// The TEditStyleHookColor vcl style hook allows you to use custom colors in the TCustomEdit descendent components 33 | /// 34 | /// 35 | /// You can use this hook on these components 36 | /// TEdit, TButtonedEdit, TMaskEdit, TEditStyleHookColor 37 | /// 38 | /// TStyleManager.Engine.RegisterStyleHook(TEdit, TEditStyleHookColor); 39 | /// 40 | /// 41 | TEditStyleHookColor = class(TEditStyleHook) 42 | strict private 43 | procedure UpdateColors; 44 | protected 45 | procedure WndProc(var Message: TMessage); override; 46 | public 47 | constructor Create(AControl: TWinControl); override; 48 | end; 49 | 50 | /// The TMemoStyleHookColor vcl style hook allows you to use custom colors in the TCustomMemo descendent components 51 | /// 52 | /// 53 | /// You can use this hook on these components 54 | /// TMemo, TMemoStyleHookColor 55 | /// 56 | /// TStyleManager.Engine.RegisterStyleHook(TMemo, TMemoStyleHookColor); 57 | /// 58 | /// 59 | TMemoStyleHookColor = class(TMemoStyleHook) 60 | strict private 61 | procedure UpdateColors; 62 | protected 63 | procedure WndProc(var Message: TMessage); override; 64 | public 65 | constructor Create(AControl: TWinControl); override; 66 | end; 67 | 68 | implementation 69 | 70 | Uses 71 | System.UITypes, 72 | Winapi.Windows, 73 | Vcl.Graphics, 74 | Vcl.Themes, 75 | Vcl.Styles; 76 | 77 | 78 | type 79 | TWinControlClass= class(TWinControl); 80 | 81 | 82 | constructor TEditStyleHookColor.Create(AControl: TWinControl); 83 | begin 84 | inherited; 85 | UpdateColors; 86 | end; 87 | 88 | procedure TEditStyleHookColor.UpdateColors; 89 | var 90 | LStyle: TCustomStyleServices; 91 | begin 92 | if Control.Enabled then 93 | begin 94 | Brush.Color := TWinControlClass(Control).Color; 95 | FontColor := TWinControlClass(Control).Font.Color; 96 | end 97 | else 98 | begin 99 | LStyle := StyleServices; 100 | Brush.Color := LStyle.GetStyleColor(scEditDisabled); 101 | FontColor := LStyle.GetStyleFontColor(sfEditBoxTextDisabled); 102 | end; 103 | end; 104 | 105 | procedure TEditStyleHookColor.WndProc(var Message: TMessage); 106 | begin 107 | case Message.Msg of 108 | CN_CTLCOLORMSGBOX..CN_CTLCOLORSTATIC: 109 | begin 110 | UpdateColors; 111 | SetTextColor(Message.WParam, ColorToRGB(FontColor)); 112 | SetBkColor(Message.WParam, ColorToRGB(Brush.Color)); 113 | Message.Result := LRESULT(Brush.Handle); 114 | Handled := True; 115 | end; 116 | CM_ENABLEDCHANGED: 117 | begin 118 | UpdateColors; 119 | Handled := False; 120 | end 121 | else 122 | inherited WndProc(Message); 123 | end; 124 | end; 125 | 126 | { TMemoStyleHookColor } 127 | 128 | constructor TMemoStyleHookColor.Create(AControl: TWinControl); 129 | begin 130 | inherited; 131 | UpdateColors; 132 | end; 133 | 134 | procedure TMemoStyleHookColor.UpdateColors; 135 | var 136 | LStyle: TCustomStyleServices; 137 | begin 138 | if Control.Enabled then 139 | begin 140 | Brush.Color := TWinControlClass(Control).Color; 141 | FontColor := TWinControlClass(Control).Font.Color; 142 | end 143 | else 144 | begin 145 | LStyle := StyleServices; 146 | Brush.Color := LStyle.GetStyleColor(scEditDisabled); 147 | FontColor := LStyle.GetStyleFontColor(sfEditBoxTextDisabled); 148 | end; 149 | end; 150 | 151 | procedure TMemoStyleHookColor.WndProc(var Message: TMessage); 152 | begin 153 | case Message.Msg of 154 | CN_CTLCOLORMSGBOX..CN_CTLCOLORSTATIC: 155 | begin 156 | UpdateColors; 157 | SetTextColor(Message.WParam, ColorToRGB(FontColor)); 158 | SetBkColor(Message.WParam, ColorToRGB(Brush.Color)); 159 | Message.Result := LRESULT(Brush.Handle); 160 | Handled := True; 161 | end; 162 | 163 | CM_COLORCHANGED, 164 | CM_ENABLEDCHANGED: 165 | begin 166 | UpdateColors; 167 | Handled := False; 168 | end 169 | else 170 | inherited WndProc(Message); 171 | end; 172 | end; 173 | 174 | end. 175 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.DateTimePickers.pas: -------------------------------------------------------------------------------- 1 | //************************************************************************************************** 2 | // 3 | // Unit Vcl.Styles.DateTimePickers 4 | // unit for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // The Original Code is Vcl.Styles.DateTimePickers 16 | // 17 | // The Initial Developer of the Original Code is Rodrigo Ruz V. 18 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2023 Rodrigo Ruz V. 19 | // All Rights Reserved. 20 | // 21 | //************************************************************************************************** 22 | unit Vcl.Styles.DateTimePickers; 23 | 24 | interface 25 | 26 | {$IF RTLVersion>=24} 27 | {$LEGACYIFEND ON} 28 | {$IFEND} 29 | {$IF (CompilerVersion >= 31)} 30 | {$MESSAGE ERROR 'This unit is deprecated, Use the Vcl.Styles.Hooks unit Instead'} 31 | {$ELSE} 32 | uses 33 | Winapi.CommCtrl, 34 | Winapi.Messages, 35 | Winapi.uxTheme, 36 | Vcl.Graphics, 37 | Vcl.ComCtrls, 38 | Vcl.Controls; 39 | 40 | type 41 | TDateTimePickerStyleHookFix = class(TDateTimePickerStyleHook) 42 | private 43 | procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY; 44 | procedure WMPaint(var Message: TMessage); message WM_PAINT; 45 | procedure SetColorsCalendar; 46 | public 47 | procedure PaintBackground(Canvas: TCanvas); override; 48 | constructor Create(AControl: TWinControl); override; 49 | end deprecated 'Use the Vcl.Styles.Hooks unit Instead'; 50 | 51 | implementation 52 | 53 | uses 54 | System.SysUtils, 55 | System.Classes, 56 | WinApi.Windows, 57 | Vcl.Styles, 58 | Vcl.Themes; 59 | 60 | type 61 | TDateTimePickerStyleHookHelper = class helper for TDateTimePickerStyleHook 62 | private 63 | function GetDroppedDown: Boolean; 64 | procedure SetDroppedDown(const Value: Boolean); 65 | function GetMouseOnButton: Boolean; 66 | procedure SetMouseOnButton(const Value: Boolean); 67 | public 68 | function GetButtonRect_: TRect; 69 | property _FDroppedDown: Boolean read GetDroppedDown Write SetDroppedDown; 70 | property _FMouseOnButton: Boolean read GetMouseOnButton Write SetMouseOnButton; 71 | end; 72 | 73 | { TDateTimePickerStyleHookHelper } 74 | function TDateTimePickerStyleHookHelper.GetButtonRect_: TRect; 75 | begin 76 | Result:=Self.GetButtonRect; 77 | end; 78 | 79 | function TDateTimePickerStyleHookHelper.GetDroppedDown: Boolean; 80 | begin 81 | Result:=Self.FDroppedDown; 82 | end; 83 | 84 | function TDateTimePickerStyleHookHelper.GetMouseOnButton: Boolean; 85 | begin 86 | Result:=Self.FMouseOnButton; 87 | end; 88 | 89 | procedure TDateTimePickerStyleHookHelper.SetDroppedDown(const Value: Boolean); 90 | begin 91 | Self.FDroppedDown:=Value; 92 | end; 93 | 94 | procedure TDateTimePickerStyleHookHelper.SetMouseOnButton(const Value: Boolean); 95 | begin 96 | Self.FMouseOnButton:=Value; 97 | end; 98 | 99 | { TDateTimePickerStyleHookFix } 100 | procedure TDateTimePickerStyleHookFix.SetColorsCalendar; 101 | Var 102 | LTextColor, LBackColor: TColor; 103 | LDateTimePicker: TDateTimePicker; 104 | begin 105 | LDateTimePicker:=TDateTimePicker(Control); 106 | //get the vcl styles colors 107 | LTextColor:=StyleServices.GetSystemColor(clWindowText); 108 | LBackColor:=StyleServices.GetSystemColor(clWindow); 109 | 110 | LDateTimePicker.Color:=LBackColor; 111 | //set the colors of the calendar 112 | LDateTimePicker.CalColors.BackColor:=LBackColor; 113 | LDateTimePicker.CalColors.MonthBackColor:=LBackColor; 114 | LDateTimePicker.CalColors.TextColor:=LTextColor; 115 | LDateTimePicker.CalColors.TitleBackColor:=LBackColor; 116 | LDateTimePicker.CalColors.TitleTextColor:=LTextColor; 117 | LDateTimePicker.CalColors.TrailingTextColor:=LTextColor; 118 | end; 119 | 120 | procedure TDateTimePickerStyleHookFix.CNNotify(var Message: TWMNotify); 121 | var 122 | hwnd: WinAPi.Windows.HWND; 123 | begin 124 | CallDefaultProc(TMessage(Message)); 125 | if Kind = dtkDate then 126 | with Message, NMHdr^ do 127 | begin 128 | Result := 0; 129 | case code of 130 | 131 | DTN_DROPDOWN: 132 | begin 133 | SetColorsCalendar; 134 | hwnd := SendMessage(TDateTimePicker(Control).Handle, DTM_GETMONTHCAL, 0,0); 135 | if (Winapi.uxTheme.GetWindowTheme(hwnd)<>0) then 136 | Winapi.uxTheme.SetWindowTheme(hwnd, '', '');//disable themes in the drop down window 137 | 138 | _FDroppedDown := True; 139 | RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_UPDATENOW); 140 | if not TStyleManager.SystemStyle.Enabled then 141 | begin 142 | SetRedraw(False); 143 | SetTimer(Handle, 1, 300, nil); 144 | end; 145 | end; 146 | 147 | DTN_CLOSEUP: 148 | begin 149 | _FDroppedDown := False; 150 | _FMouseOnButton := False; 151 | RedrawWindow(Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_UPDATENOW); 152 | end; 153 | end; 154 | end; 155 | Handled := True; 156 | end; 157 | 158 | 159 | constructor TDateTimePickerStyleHookFix.Create(AControl: TWinControl); 160 | begin 161 | inherited; 162 | OverrideEraseBkgnd:=True;//this indicates which this style hook will call the PaintBackground method when the WM_ERASEBKGND message is sent. 163 | end; 164 | 165 | procedure TDateTimePickerStyleHookFix.PaintBackground(Canvas: TCanvas); 166 | begin 167 | //use the proper style color to paint the background 168 | Canvas.Brush.Color := StyleServices.GetStyleColor(scEdit); 169 | Canvas.FillRect(Control.ClientRect); 170 | end; 171 | 172 | procedure TDateTimePickerStyleHookFix.WMPaint(var Message: TMessage); 173 | var 174 | DC: HDC; 175 | LCanvas: TCanvas; 176 | LPaintStruct: TPaintStruct; 177 | LRect: TRect; 178 | LDetails: TThemedElementDetails; 179 | sDateTime: string; 180 | begin 181 | DC := Message.WParam; 182 | LCanvas := TCanvas.Create; 183 | try 184 | if DC <> 0 then 185 | LCanvas.Handle := DC 186 | else 187 | LCanvas.Handle := BeginPaint(Control.Handle, LPaintStruct); 188 | 189 | if not TStyleManager.ActiveStyle.IsSystemStyle and (Winapi.uxTheme.GetWindowTheme(Control.Handle )<>0) then 190 | Winapi.uxTheme.SetWindowTheme(Control.Handle, '', '');//disable themes in the calendar 191 | 192 | PaintNC(LCanvas); 193 | Paint(LCanvas); 194 | 195 | if DateMode = dmUpDown then 196 | LRect := Rect(2, 2, Control.Width - 2, Control.Height - 2) 197 | else 198 | LRect := Rect(2, 2, GetButtonRect_.Left, Control.Height - 2); 199 | 200 | if ShowCheckBox then LRect.Left := LRect.Height + 2; 201 | IntersectClipRect(LCanvas.Handle, LRect.Left, LRect.Top, LRect.Right, LRect.Bottom); 202 | Message.wParam := WPARAM(LCanvas.Handle); 203 | 204 | //only works for DateFormat = dfShort 205 | case TDateTimePicker(Control).Kind of 206 | dtkDate: sDateTime:=DateToStr(TDateTimePicker(Control).DateTime); 207 | dtkTime: sDateTime:=TimeToStr(TDateTimePicker(Control).DateTime); 208 | end; 209 | 210 | //draw the current date/time value 211 | LDetails := StyleServices.GetElementDetails(teEditTextNormal); 212 | DrawControlText(LCanvas, LDetails, sDateTime, LRect, DT_VCENTER or DT_LEFT); 213 | 214 | if not TStyleManager.SystemStyle.Enabled then 215 | Paint(LCanvas); 216 | 217 | Message.WParam := DC; 218 | if DC = 0 then 219 | EndPaint(Control.Handle, LPaintStruct); 220 | finally 221 | LCanvas.Handle := 0; 222 | LCanvas.Free; 223 | end; 224 | Handled := True; 225 | end; 226 | {$IFEND} 227 | end. 228 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.DbGrid.pas: -------------------------------------------------------------------------------- 1 | //************************************************************************************************** 2 | // 3 | // Unit Vcl.Styles.DbGrid 4 | // unit for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // The Original Code is Vcl.Styles.DbGrid.pas. 16 | // 17 | // The Initial Developer of the Original Code is Rodrigo Ruz V. 18 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2023 Rodrigo Ruz V. 19 | // All Rights Reserved. 20 | // 21 | //************************************************************************************************** 22 | unit Vcl.Styles.DbGrid; 23 | 24 | interface 25 | 26 | uses 27 | Winapi.Windows, 28 | Vcl.Grids, 29 | Vcl.Graphics, 30 | Vcl.DBGrids; 31 | 32 | type 33 | TDBGrid = class(Vcl.DBGrids.TDBGrid) 34 | protected 35 | procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); override; 36 | end; 37 | 38 | implementation 39 | 40 | uses 41 | Data.DB, 42 | System.SysUtils, 43 | System.Classes, 44 | System.UITypes, 45 | Vcl.ImgList, 46 | Vcl.Forms, 47 | Vcl.Styles, 48 | Vcl.Themes, 49 | Vcl.Controls; 50 | 51 | type 52 | TCustomGridClass = class(TCustomGrid); 53 | TDbGridHelper = class helper for TCustomDBGrid 54 | private 55 | function GetTitleOffset: Byte; 56 | function GetIndicators: TCustomImageList; 57 | function GetSelRow: Integer; 58 | procedure SetSelRow(const Value: Integer); 59 | public 60 | property TitleOffset: Byte read GetTitleOffset; 61 | property Indicators: TCustomImageList read GetIndicators; 62 | property SelRow: Integer read GetSelRow write SetSelRow; 63 | end; 64 | 65 | { TDbGridHelper } 66 | 67 | function TDbGridHelper.GetIndicators: TCustomImageList; 68 | begin 69 | with Self do 70 | Result := FIndicators; 71 | end; 72 | 73 | function TDbGridHelper.GetSelRow: Integer; 74 | begin 75 | with Self do 76 | Result := FSelRow; 77 | end; 78 | 79 | function TDbGridHelper.GetTitleOffset: Byte; 80 | begin 81 | with Self do 82 | Result := FTitleOffset; 83 | end; 84 | 85 | procedure TDbGridHelper.SetSelRow(const Value: Integer); 86 | begin 87 | with Self do 88 | FSelRow := Value; 89 | end; 90 | 91 | procedure _WriteText(ACanvas: TCanvas; ARect: TRect; DX, DY: Integer; const AText: string; Alignment: TAlignment; ARightToLeft: Boolean); 92 | var 93 | X: Integer; 94 | begin 95 | if (ACanvas.CanvasOrientation = coRightToLeft) and (not ARightToLeft) then 96 | ChangeBiDiModeAlignment(Alignment); 97 | case Alignment of 98 | taLeftJustify: X := ARect.Left + DX; 99 | taRightJustify: X := ARect.Right - ACanvas.TextWidth(AText) - 3; 100 | else 101 | X := ARect.Left + (ARect.Right - ARect.Left) shr 1 - (ACanvas.TextWidth(AText) shr 1); 102 | end; 103 | ACanvas.TextRect(ARect, X, ARect.Top + DY, AText); 104 | end; 105 | 106 | 107 | { TDBGrid } 108 | 109 | procedure TDBGrid.DrawCell(ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState); 110 | var 111 | OldActive: Integer; 112 | Indicator: TThemedGrid; 113 | Value: string; 114 | CurrentColumn: TColumn; 115 | MultiSelected: Boolean; 116 | X: Integer; 117 | LStyleServices: TCustomStyleServices; 118 | DeltaX: Byte; 119 | Index: Integer; 120 | begin 121 | LStyleServices := StyleServices; 122 | if not TStyleManager.IsCustomStyleActive or (ARow-TitleOffset<0) then 123 | begin 124 | inherited DrawCell(ACol, ARow, ARect, AState); 125 | exit; 126 | end; 127 | 128 | if csLoading in ComponentState then 129 | begin 130 | Canvas.Brush.Color := LStyleServices.GetStyleColor(scGrid); 131 | Canvas.FillRect(ARect); 132 | Exit; 133 | end; 134 | 135 | Dec(ARow, TitleOffset); 136 | Dec(ACol, IndicatorOffset); 137 | 138 | if (gdFixed in AState) and ([dgRowLines, dgColLines] * Options = 139 | [dgRowLines, dgColLines]) then 140 | begin 141 | Winapi.Windows.InflateRect(ARect, -1, -1); 142 | DeltaX := 1; 143 | end 144 | else 145 | DeltaX := 2; 146 | 147 | if (gdFixed in AState) and (ACol < 0) then 148 | begin 149 | DrawCellBackground(ARect, FixedColor, AState, ACol, ARow); 150 | if Assigned(DataLink) and DataLink.Active then 151 | begin 152 | MultiSelected := False; 153 | 154 | if ARow >= 0 then 155 | begin 156 | OldActive := DataLink.ActiveRecord; 157 | try 158 | DataLink.ActiveRecord := ARow; 159 | MultiSelected := (dgMultiSelect in Options) and Datalink.Active and SelectedRows.Find(Datalink.Datasource.Dataset.Bookmark, Index);; 160 | finally 161 | DataLink.ActiveRecord := OldActive; 162 | end; 163 | end; 164 | 165 | if (ARow = DataLink.ActiveRecord) or MultiSelected then 166 | begin 167 | Indicator := tgIndicatorArrow; 168 | if DataLink.DataSet <> nil then 169 | case DataLink.DataSet.State of 170 | dsEdit: Indicator := tgIndicatorEdit; 171 | dsInsert: Indicator := tgIndicatorInsert; 172 | dsBrowse: 173 | if MultiSelected then 174 | if (ARow <> DataLink.ActiveRecord) then 175 | Indicator := tgIndicatorMultiDot 176 | else 177 | Indicator := tgIndicatorMultiArrow; 178 | end; 179 | Indicators.BkColor := FixedColor; 180 | X := ARect.Right - Indicators.Width - DeltaX; 181 | if Canvas.CanvasOrientation = coRightToLeft then 182 | Inc(X); 183 | 184 | if LStyleServices.Enabled and not LStyleServices.IsSystemStyle then 185 | LStyleServices.DrawElement(Canvas.Handle, LStyleServices.GetElementDetails(Indicator), ARect) 186 | else 187 | Indicators.Draw(Canvas, X, (ARect.Top + ARect.Bottom - Indicators.Height) shr 1, Integer(Indicator) - Integer(tgIndicatorArrow), True); 188 | 189 | if ARow = Datalink.ActiveRecord then 190 | SelRow := ARow + TitleOffset; 191 | end; 192 | end; 193 | end 194 | else 195 | with Canvas do 196 | begin 197 | CurrentColumn := Columns[ACol]; 198 | if not CurrentColumn.Showing then Exit; 199 | if not (gdFixed in AState) then 200 | begin 201 | Font := CurrentColumn.Font; 202 | Brush.Color := CurrentColumn.Color; 203 | 204 | if (Brush.Color=LStyleServices.GetStyleColor(scGrid)) then 205 | begin 206 | Font.Color := LStyleServices.GetStyleFontColor(sfGridItemNormal); 207 | Brush.Color := LStyleServices.GetStyleColor(scGrid); 208 | end; 209 | 210 | end; 211 | 212 | if (DataLink = nil) or not DataLink.Active then 213 | FillRect(ARect) 214 | else 215 | begin 216 | Value := ''; 217 | OldActive := DataLink.ActiveRecord; 218 | try 219 | DataLink.ActiveRecord := ARow; 220 | if Assigned(CurrentColumn.Field) then 221 | Value := CurrentColumn.Field.DisplayText; 222 | if HighlightCell(ACol, ARow, Value, AState) and DefaultDrawing then 223 | DrawCellHighlight(ARect, AState, ACol, ARow); 224 | if not Enabled then 225 | Font.Color := clGrayText; 226 | 227 | if DefaultDrawing then 228 | _WriteText(Canvas, ARect, 3, 2, Value, CurrentColumn.Alignment, UseRightToLeftAlignmentForField(CurrentColumn.Field, CurrentColumn.Alignment)); 229 | 230 | if Columns.State = csDefault then 231 | DrawDataCell(ARect, CurrentColumn.Field, AState); 232 | DrawColumnCell(ARect, ACol, CurrentColumn, AState); 233 | finally 234 | DataLink.ActiveRecord := OldActive; 235 | end; 236 | Canvas.Brush.Style := bsSolid; 237 | 238 | if DefaultDrawing and (gdSelected in AState) and ((dgAlwaysShowSelection in Options) or Focused) 239 | and not (csDesigning in ComponentState) and not (dgRowSelect in Options) 240 | and (UpdateLock = 0) and (ValidParentForm(Self).ActiveControl = Self) and 241 | (FInternalDrawingStyle = gdsThemed) and (Win32MajorVersion >= 6) then 242 | Winapi.Windows.InflateRect(ARect, -1, -1); 243 | 244 | end; 245 | end; 246 | 247 | if (gdFixed in AState) and ([dgRowLines, dgColLines] * Options = 248 | [dgRowLines, dgColLines]) and (FInternalDrawingStyle = gdsClassic) and 249 | not (gdPressed in AState) then 250 | Winapi.Windows.InflateRect(ARect, 1, 1); 251 | end; 252 | 253 | 254 | end. 255 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.OwnerDrawFix.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // 3 | // Unit Vcl.Styles.OwnerDrawFix 4 | // unit for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // The Original Code is Vcl.Styles.OwnerDrawFix.pas. 16 | // 17 | // The Initial Developer of the Original Code is Rodrigo Ruz V. 18 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2023 Rodrigo Ruz V. 19 | // All Rights Reserved. 20 | // 21 | // ************************************************************************************************** 22 | unit Vcl.Styles.OwnerDrawFix; 23 | 24 | interface 25 | 26 | uses 27 | Winapi.Windows, 28 | Winapi.CommCtrl, 29 | Vcl.ComCtrls, 30 | Vcl.Graphics, 31 | Vcl.StdCtrls, 32 | Vcl.Controls, 33 | Vcl.Styles, 34 | Vcl.Themes, 35 | System.Classes; 36 | 37 | type 38 | TVclStylesOwnerDrawFix = class 39 | public 40 | procedure ComboBoxDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); 41 | procedure ListBoxDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); 42 | procedure ListViewDrawItem(Sender: TCustomListView; Item: TListItem; Rect: TRect; State: TOwnerDrawState); 43 | procedure ListViewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 44 | end deprecated 'Use the Vcl.Styles.Hooks unit Instead'; 45 | 46 | {$WARN SYMBOL_DEPRECATED OFF} 47 | var 48 | VclStylesOwnerDrawFix: TVclStylesOwnerDrawFix; 49 | 50 | implementation 51 | 52 | uses 53 | System.SysUtils; 54 | 55 | type 56 | TCustomListViewClass = class(TCustomListView); 57 | 58 | { TVclStylesOwnerDrawFix } 59 | 60 | procedure TVclStylesOwnerDrawFix.ComboBoxDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; 61 | State: TOwnerDrawState); 62 | const 63 | ColorStates: array [Boolean] of TStyleColor = (scComboBoxDisabled, scComboBox); 64 | FontColorStates: array [Boolean] of TStyleFont = (sfComboBoxItemDisabled, sfComboBoxItemNormal); 65 | var 66 | LStyles: TCustomStyleServices; 67 | begin 68 | LStyles := StyleServices; 69 | with Control as TComboBox do 70 | begin 71 | Canvas.Brush.Color := LStyles.GetStyleColor(ColorStates[Control.Enabled]); 72 | Canvas.Font.Color := LStyles.GetStyleFontColor(FontColorStates[Control.Enabled]); 73 | 74 | if odSelected in State then 75 | begin 76 | Canvas.Brush.Color := LStyles.GetSystemColor(clHighlight); 77 | Canvas.Font.Color := LStyles.GetSystemColor(clHighlightText); 78 | end; 79 | 80 | Canvas.FillRect(Rect); 81 | Canvas.TextOut(Rect.Left + 2, Rect.Top, Items[Index]); 82 | end; 83 | end; 84 | 85 | procedure TVclStylesOwnerDrawFix.ListBoxDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; 86 | State: TOwnerDrawState); 87 | Var 88 | LListBox: TListBox; 89 | LStyles: TCustomStyleServices; 90 | LDetails: TThemedElementDetails; 91 | begin 92 | LListBox := TListBox(Control); 93 | LStyles := StyleServices; 94 | 95 | if odSelected in State then 96 | LListBox.Brush.Color := LStyles.GetSystemColor(clHighlight); 97 | 98 | LDetails := StyleServices.GetElementDetails(tlListItemNormal); 99 | 100 | LListBox.Canvas.FillRect(Rect); 101 | Rect.Left := Rect.Left + 2; 102 | LStyles.DrawText(LListBox.Canvas.Handle, LDetails, LListBox.Items[Index], Rect, 103 | [tfLeft, tfSingleLine, tfVerticalCenter]); 104 | 105 | if odFocused In State then 106 | begin 107 | LListBox.Canvas.Brush.Color := LStyles.GetSystemColor(clHighlight); 108 | LListBox.Canvas.DrawFocusRect(Rect); 109 | end; 110 | end; 111 | 112 | procedure TVclStylesOwnerDrawFix.ListViewDrawItem(Sender: TCustomListView; Item: TListItem; Rect: TRect; 113 | State: TOwnerDrawState); 114 | const 115 | Spacing = 4; 116 | var 117 | Dx: Integer; 118 | r: TRect; 119 | rc: TRect; 120 | ColIdx: Integer; 121 | s: string; 122 | LDetails: TThemedElementDetails; 123 | LStyles: TCustomStyleServices; 124 | BoxSize: TSize; 125 | LColor: TColor; 126 | ImageSize: Integer; 127 | begin 128 | LStyles := StyleServices; 129 | if not LStyles.GetElementColor(LStyles.GetElementDetails(ttItemNormal), ecTextColor, LColor) or (LColor = clNone) then 130 | LColor := LStyles.GetSystemColor(clWindowText); 131 | 132 | Sender.Canvas.Brush.Color := LStyles.GetStyleColor(scListView); 133 | Sender.Canvas.Font.Color := LColor; 134 | Sender.Canvas.FillRect(Rect); 135 | 136 | r := Rect; 137 | inc(r.Left, Spacing); 138 | for ColIdx := 0 to TListView(Sender).Columns.Count - 1 do 139 | begin 140 | Dx := 0; 141 | r.Right := r.Left + Sender.Column[ColIdx].Width; 142 | 143 | if (ColIdx > 0) and (Item.SubItems.Count >= ColIdx) then 144 | s := Item.SubItems[ColIdx - 1] 145 | else 146 | begin 147 | BoxSize.cx := GetSystemMetrics(SM_CXMENUCHECK); 148 | BoxSize.cy := GetSystemMetrics(SM_CYMENUCHECK); 149 | s := Item.Caption; 150 | if TListView(Sender).Checkboxes then 151 | begin 152 | inc(Dx, BoxSize.cx + 3); 153 | r.Left := r.Left + BoxSize.cx + 3; 154 | end; 155 | end; 156 | 157 | if ColIdx = 0 then 158 | begin 159 | if not IsWindowVisible(ListView_GetEditControl(Sender.Handle)) and ([odSelected, odHotLight] * State <> []) then 160 | begin 161 | if ([odSelected, odHotLight] * State <> []) then 162 | begin 163 | rc := Rect; 164 | if TListView(Sender).Checkboxes then 165 | rc.Left := rc.Left + BoxSize.cx + Spacing; 166 | 167 | if not TListView(Sender).RowSelect then 168 | rc.Right := Sender.Column[0].Width; 169 | 170 | Sender.Canvas.Brush.Color := LStyles.GetSystemColor(clHighlight); 171 | Sender.Canvas.FillRect(rc); 172 | end; 173 | end; 174 | end; 175 | 176 | if TListView(Sender).RowSelect then 177 | Sender.Canvas.Brush.Color := LStyles.GetSystemColor(clHighlight); 178 | 179 | if (ColIdx = 0) and (TCustomListViewClass(Sender).SmallImages <> nil) and 180 | (TCustomListViewClass(Sender).SmallImages.Handle <> 0) and (Item.ImageIndex >= 0) then 181 | begin 182 | ImageList_Draw(TCustomListViewClass(Sender).SmallImages.Handle, Item.ImageIndex, Sender.Canvas.Handle, r.Left - 2, 183 | r.Top, ILD_NORMAL); 184 | ImageSize := TCustomListViewClass(Sender).SmallImages.Width; 185 | inc(Dx, ImageSize); 186 | r.Left := r.Left + ImageSize; 187 | end; 188 | 189 | if ([odSelected, odHotLight] * State <> []) then 190 | LDetails := StyleServices.GetElementDetails(tlListItemSelected) 191 | else 192 | LDetails := StyleServices.GetElementDetails(tlListItemNormal); 193 | 194 | Sender.Canvas.Brush.Style := bsClear; 195 | LStyles.DrawText(Sender.Canvas.Handle, LDetails, s, r, [tfLeft, tfSingleLine, tfVerticalCenter, tfEndEllipsis]); 196 | 197 | if (ColIdx = 0) and TListView(Sender).Checkboxes then 198 | begin 199 | rc := Rect; 200 | rc.Top := Rect.Top + (Rect.Bottom - Rect.Top - BoxSize.cy) div 2; 201 | rc.Bottom := rc.Top + BoxSize.cy; 202 | rc.Left := rc.Left + Spacing; 203 | rc.Right := rc.Left + BoxSize.cx; 204 | 205 | if Item.Checked then 206 | LDetails := StyleServices.GetElementDetails(tbCheckBoxCheckedNormal) 207 | else 208 | LDetails := StyleServices.GetElementDetails(tbCheckBoxUncheckedNormal); 209 | 210 | LStyles.DrawElement(Sender.Canvas.Handle, LDetails, rc); 211 | end; 212 | 213 | if ColIdx = 0 then 214 | r.Left := r.Left - Dx; 215 | { else } 216 | inc(r.Left, Sender.Column[ColIdx].Width); 217 | end; 218 | 219 | end; 220 | 221 | procedure TVclStylesOwnerDrawFix.ListViewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; 222 | X, Y: Integer); 223 | const 224 | Spacing = 4; 225 | var 226 | LDetails: TThemedElementDetails; 227 | Size: TSize; 228 | begin 229 | if TListView(Sender).OwnerDraw and (TListView(Sender).Checkboxes) then 230 | begin 231 | LDetails := StyleServices.GetElementDetails(tbCheckBoxCheckedNormal); 232 | Size.cx := 0; 233 | Size.cy := 0; 234 | 235 | if StyleServices.GetElementSize(TListView(Sender).Canvas.Handle, LDetails, esMinimum, Size) and (X > Spacing) and 236 | (X <= Size.Width) then 237 | TListView(Sender).Selected.Checked := not TListView(Sender).Selected.Checked; 238 | 239 | // OutputDebugString(PChar(Format('X %d Size.Width %d',[X, Size.Width]))); 240 | end; 241 | end; 242 | 243 | initialization 244 | 245 | VclStylesOwnerDrawFix := TVclStylesOwnerDrawFix.Create; 246 | 247 | finalization 248 | 249 | VclStylesOwnerDrawFix.Free; 250 | 251 | end. 252 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.Register.pas: -------------------------------------------------------------------------------- 1 | unit Vcl.Styles.Register; 2 | 3 | interface 4 | 5 | procedure Register; 6 | 7 | implementation 8 | 9 | uses 10 | System.Classes, Vcl.Styles.Preview; 11 | 12 | procedure Register; 13 | begin 14 | RegisterComponents('VisualStyles', [TVisualStylePreview]); 15 | end; 16 | 17 | end. 18 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.Utils.ScreenTips.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // 3 | // Unit Vcl.Styles.Utils.ScreenTips 4 | // unit for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // 16 | // Portions created by Mahdi Safsafi [SMP3] e-mail SMP@LIVE.FR 17 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2013-2023 Rodrigo Ruz V. 18 | // All Rights Reserved. 19 | // 20 | // ************************************************************************************************** 21 | unit Vcl.Styles.Utils.ScreenTips; 22 | 23 | interface 24 | 25 | uses 26 | System.Classes, 27 | System.SysUtils, 28 | Winapi.Windows, 29 | Winapi.Messages, 30 | Vcl.Themes, 31 | Vcl.Graphics, 32 | Vcl.Controls, 33 | Vcl.Styles.Utils.SysStyleHook, 34 | Vcl.Forms, 35 | Vcl.GraphUtil; 36 | 37 | type 38 | TSysTooltipsStyleHook = class(TSysStyleHook) 39 | private 40 | procedure WMPaint(var Message: TMessage); message WM_PAINT; 41 | 42 | protected 43 | procedure Paint(Canvas: TCanvas); override; 44 | procedure PaintHint(Canvas: TCanvas; TextRect: TRect); 45 | procedure WndProc(var Message: TMessage); override; 46 | 47 | public 48 | constructor Create(AHandle: THandle); override; 49 | Destructor Destroy; override; 50 | 51 | end; 52 | 53 | implementation 54 | 55 | uses 56 | Winapi.CommCtrl, 57 | {$IF CompilerVersion >= 30.0} //DX Seattle and UP. 58 | Vcl.SysStyles, 59 | {$IFEND} 60 | Vcl.Styles.Utils.SysControls; 61 | 62 | { TSysTooltipsStyleHook } 63 | const 64 | TTM_ADJUSTRECT = WM_USER + 31; 65 | 66 | procedure TSysTooltipsStyleHook.PaintHint(Canvas: TCanvas; TextRect: TRect); 67 | var 68 | DC: HDC; 69 | LDetails: TThemedElementDetails; 70 | BkColor, GradientStartColor, GradientEndColor, TextColor, LColor: TColor; 71 | Brush: HBRUSH; 72 | AText: PChar; 73 | begin 74 | DC := Canvas.Handle; 75 | BkColor := $00767676; 76 | GradientStartColor := clWhite; 77 | GradientEndColor := $EFE4E3; 78 | TextColor := $00575757; 79 | 80 | if StyleServices.Enabled then 81 | begin 82 | LDetails := StyleServices.GetElementDetails(thHintBalloon); 83 | if StyleServices.GetElementColor(LDetails, ecBorderColor, LColor) and (LColor <> clNone) then 84 | BkColor := LColor; 85 | if StyleServices.GetElementColor(LDetails, ecGradientColor1, LColor) and (LColor <> clNone) then 86 | GradientStartColor := LColor; 87 | if StyleServices.GetElementColor(LDetails, ecGradientColor2, LColor) and (LColor <> clNone) then 88 | GradientEndColor := LColor; 89 | if StyleServices.GetElementColor(LDetails, ecTextColor, LColor) and (LColor <> clNone) then 90 | TextColor := LColor; 91 | end; 92 | { Draw Tooltips Face } 93 | GradientFillCanvas(Canvas, GradientStartColor, GradientEndColor, SysControl.ClientRect, gdVertical); 94 | { Draw Tooltips Border } 95 | Brush := CreateSolidBrush(ColorToRGB(BkColor)); 96 | FrameRect(DC, SysControl.ClientRect, Brush); 97 | DeleteObject(Brush); 98 | { Use default font for Tooltips text } 99 | SelectObject(DC, Screen.HintFont.Handle); 100 | { Draw Tooltips Text } 101 | SetBkMode(DC, TRANSPARENT); 102 | SetTextColor(DC, ColorToRGB(TextColor)); 103 | AText := PChar(SysControl.Text); 104 | Winapi.Windows.DrawText(DC, AText, -1, TextRect, DT_LEFT); 105 | end; 106 | 107 | procedure TSysTooltipsStyleHook.WMPaint(var Message: TMessage); 108 | begin 109 | CallDefaultProc(Message); 110 | if (GetWindowLong(Handle, GWL_STYLE) and TTS_BALLOON) = TTS_BALLOON then 111 | Handled := True 112 | else 113 | inherited; 114 | end; 115 | 116 | procedure TSysTooltipsStyleHook.WndProc(var Message: TMessage); 117 | begin 118 | inherited; 119 | end; 120 | 121 | constructor TSysTooltipsStyleHook.Create(AHandle: THandle); 122 | begin 123 | inherited; 124 | {$IF CompilerVersion > 23.0} 125 | StyleElements := [seClient]; 126 | {$ELSE} 127 | OverridePaint := True; 128 | OverridePaintNC := False; 129 | OverrideFont := False; 130 | {$IFEND} 131 | end; 132 | 133 | destructor TSysTooltipsStyleHook.Destroy; 134 | begin 135 | inherited; 136 | end; 137 | 138 | procedure TSysTooltipsStyleHook.Paint(Canvas: TCanvas); 139 | Var 140 | TextRect: TRect; 141 | begin 142 | { Adjust text rectangle } 143 | TextRect := SysControl.ClientRect; 144 | SendMessage(Handle, TTM_ADJUSTRECT, 0, UINT_PTR(@TextRect)); 145 | PaintHint(Canvas, TextRect); 146 | end; 147 | 148 | initialization 149 | 150 | {$IF CompilerVersion >= 30.0} //DX Seattle and UP. 151 | TCustomStyleEngine.UnRegisterSysStyleHook('tooltips_class32', Vcl.SysStyles.TSysTooltipsStyleHook); 152 | {$IFEND} 153 | 154 | 155 | if StyleServices.Available then 156 | TSysStyleManager.RegisterSysStyleHook(TOOLTIPS_CLASS, TSysTooltipsStyleHook); 157 | 158 | finalization 159 | TSysStyleManager.UnRegisterSysStyleHook(TOOLTIPS_CLASS, TSysTooltipsStyleHook); 160 | 161 | end. 162 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.Utils.SysControls.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Ext/VCLStyleUtils/Common/Vcl.Styles.Utils.SysControls.pas -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.Utils.SystemMenu.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // 3 | // Unit Vcl.Styles.Utils.SystemMenu 4 | // unit for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // The Initial Developer of the Original Code is Rodrigo Ruz V. 16 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2014-2021 Rodrigo Ruz V. 17 | // All Rights Reserved. 18 | // 19 | // ************************************************************************************************** 20 | unit Vcl.Styles.Utils.SystemMenu; 21 | 22 | interface 23 | 24 | uses 25 | System.Rtti, 26 | System.Classes, 27 | System.Generics.Collections, 28 | WinApi.Windows, 29 | WinApi.Messages, 30 | Vcl.Themes, 31 | Vcl.Forms; 32 | 33 | type 34 | TMethodInfo = class; 35 | 36 | TProcCallback = reference to procedure(Info: TMethodInfo); 37 | 38 | TMethodInfo = class 39 | Value1: TValue; 40 | Value2: TValue; 41 | Method: TProcCallback; 42 | end; 43 | 44 | TVclStylesSystemMenu = class(TComponent) 45 | strict private 46 | FVCLStylesMenu: HMenu; 47 | FOrgWndProc: TWndMethod; 48 | FForm: TForm; 49 | FMethodsDict: TObjectDictionary; 50 | procedure CreateMenus; 51 | procedure DeleteMenus; 52 | procedure CreateMenuStyles; 53 | procedure WndProc(var Message: TMessage); 54 | private 55 | FMenuCaption: string; 56 | FShowNativeStyle: Boolean; 57 | procedure SetMenuCaption(const Value: string); 58 | procedure SetShowNativeStyle(const Value: Boolean); 59 | public 60 | property ShowNativeStyle: Boolean read FShowNativeStyle write SetShowNativeStyle; 61 | property MenuCaption: string read FMenuCaption write SetMenuCaption; 62 | constructor Create(AOwner: TForm); reintroduce; 63 | destructor Destroy; override; 64 | end; 65 | 66 | implementation 67 | 68 | uses 69 | Vcl.Controls, 70 | System.SysUtils; 71 | 72 | const 73 | VCLStylesMenu = WM_USER + 666; 74 | 75 | function InsertMenuHelper(HMenu: HMenu; uPosition: UINT; uIDNewItem: UINT_PTR; lpNewItem, IconName: LPCWSTR): BOOL; 76 | var 77 | LMenuItem: TMenuItemInfo; 78 | begin 79 | ZeroMemory(@LMenuItem, SizeOf(TMenuItemInfo)); 80 | LMenuItem.cbSize := SizeOf(TMenuItemInfo); 81 | LMenuItem.fMask := MIIM_FTYPE or MIIM_ID or MIIM_BITMAP or MIIM_STRING; 82 | LMenuItem.fType := MFT_STRING; 83 | LMenuItem.wID := uIDNewItem; 84 | LMenuItem.dwTypeData := lpNewItem; 85 | Result := InsertMenuItem(HMenu, uPosition, True, LMenuItem); 86 | end; 87 | 88 | procedure AddMenuSeparatorHelper(HMenu: HMenu; var MenuIndex: Integer); 89 | var 90 | LMenuInfo: TMenuItemInfo; 91 | Buffer: array [0 .. 79] of char; 92 | begin 93 | ZeroMemory(@LMenuInfo, SizeOf(TMenuItemInfo)); 94 | LMenuInfo.cbSize := SizeOf(LMenuInfo); 95 | LMenuInfo.fMask := MIIM_TYPE; 96 | LMenuInfo.dwTypeData := Buffer; 97 | LMenuInfo.cch := SizeOf(Buffer); 98 | if GetMenuItemInfo(HMenu, MenuIndex - 1, True, LMenuInfo) then 99 | begin 100 | if (LMenuInfo.fType and MFT_SEPARATOR) = MFT_SEPARATOR then 101 | else 102 | begin 103 | InsertMenu(HMenu, MenuIndex, MF_BYPOSITION or MF_SEPARATOR, 0, nil); 104 | inc(MenuIndex); 105 | end; 106 | end; 107 | end; 108 | 109 | { TVclStylesSystemMenu } 110 | 111 | constructor TVclStylesSystemMenu.Create(AOwner: TForm); 112 | begin 113 | inherited Create(AOwner); 114 | FShowNativeStyle := True; 115 | FMenuCaption := 'VCL Styles'; 116 | FForm := AOwner; 117 | FMethodsDict := TObjectDictionary.Create([doOwnsValues]); 118 | FOrgWndProc := FForm.WindowProc; 119 | FForm.WindowProc := WndProc; 120 | CreateMenus; 121 | end; 122 | 123 | destructor TVclStylesSystemMenu.Destroy; 124 | begin 125 | DeleteMenus; 126 | FForm.WindowProc := FOrgWndProc; 127 | FMethodsDict.Free; 128 | inherited; 129 | end; 130 | 131 | procedure TVclStylesSystemMenu.SetMenuCaption(const Value: string); 132 | begin 133 | DeleteMenus; 134 | FMenuCaption := Value; 135 | CreateMenus; 136 | end; 137 | 138 | procedure TVclStylesSystemMenu.SetShowNativeStyle(const Value: Boolean); 139 | begin 140 | DeleteMenus; 141 | FShowNativeStyle := Value; 142 | CreateMenus; 143 | end; 144 | 145 | procedure TVclStylesSystemMenu.CreateMenus; 146 | begin 147 | CreateMenuStyles; 148 | end; 149 | 150 | procedure TVclStylesSystemMenu.DeleteMenus; 151 | var 152 | LSysMenu: HMenu; 153 | begin 154 | if IsMenu(FVCLStylesMenu) then 155 | while GetMenuItemCount(FVCLStylesMenu) > 0 do 156 | DeleteMenu(FVCLStylesMenu, 0, MF_BYPOSITION); 157 | 158 | if FForm.HandleAllocated then 159 | begin 160 | LSysMenu := GetSystemMenu(FForm.Handle, False); 161 | if IsMenu(LSysMenu) then 162 | DeleteMenu(LSysMenu, VCLStylesMenu, MF_BYCOMMAND); 163 | end; 164 | 165 | FMethodsDict.Clear; 166 | end; 167 | 168 | procedure TVclStylesSystemMenu.CreateMenuStyles; 169 | var 170 | LSysMenu: HMenu; 171 | LMenuItem: TMenuItemInfo; 172 | uIDNewItem, LSubMenuIndex: Integer; 173 | LMethodInfo: TMethodInfo; 174 | s: string; 175 | LStyleNames: TArray; 176 | 177 | begin 178 | LSysMenu := GetSystemMenu(FForm.Handle, False); 179 | 180 | LSubMenuIndex := GetMenuItemCount(LSysMenu); 181 | AddMenuSeparatorHelper(LSysMenu, LSubMenuIndex); 182 | 183 | FVCLStylesMenu := CreatePopupMenu(); 184 | 185 | uIDNewItem := VCLStylesMenu; 186 | ZeroMemory(@LMenuItem, SizeOf(TMenuItemInfo)); 187 | LMenuItem.cbSize := SizeOf(TMenuItemInfo); 188 | LMenuItem.fMask := MIIM_SUBMENU or MIIM_FTYPE or MIIM_ID or MIIM_BITMAP or MIIM_STRING; 189 | LMenuItem.fType := MFT_STRING; 190 | LMenuItem.wID := VCLStylesMenu; 191 | LMenuItem.hSubMenu := FVCLStylesMenu; 192 | LMenuItem.dwTypeData := PWideChar(FMenuCaption); 193 | LMenuItem.cch := Length(FMenuCaption); 194 | 195 | InsertMenuItem(LSysMenu, GetMenuItemCount(LSysMenu), True, LMenuItem); 196 | inc(uIDNewItem); 197 | LSubMenuIndex := 0; 198 | 199 | LStyleNames := TStyleManager.StyleNames; 200 | TArray.Sort(LStyleNames); 201 | 202 | for s in LStyleNames do 203 | begin 204 | 205 | if not FShowNativeStyle and SameText('Windows', s) then 206 | Continue; 207 | 208 | InsertMenuHelper(FVCLStylesMenu, LSubMenuIndex, uIDNewItem, PChar(s), nil); 209 | if SameText(TStyleManager.ActiveStyle.Name, s) then 210 | CheckMenuItem(FVCLStylesMenu, LSubMenuIndex, MF_BYPOSITION or MF_CHECKED); 211 | 212 | if SameText('Windows', s) then 213 | AddMenuSeparatorHelper(FVCLStylesMenu, LSubMenuIndex); 214 | 215 | inc(LSubMenuIndex); 216 | inc(uIDNewItem); 217 | LMethodInfo := TMethodInfo.Create; 218 | LMethodInfo.Value1 := s; 219 | LMethodInfo.Method := procedure(Info: TMethodInfo) 220 | begin 221 | TStyleManager.SetStyle(Info.Value1.AsString); 222 | end; 223 | FMethodsDict.Add(uIDNewItem - 1, LMethodInfo); 224 | end; 225 | end; 226 | 227 | procedure TVclStylesSystemMenu.WndProc(var Message: TMessage); 228 | var 229 | LVerb: NativeUInt; 230 | begin 231 | case Message.Msg of 232 | CM_RECREATEWND: 233 | begin 234 | DeleteMenus; 235 | FOrgWndProc(Message); 236 | CreateMenus; 237 | end; 238 | 239 | WM_SYSCOMMAND: 240 | begin 241 | if FMethodsDict.ContainsKey(TWMSysCommand(Message).CmdType) then 242 | begin 243 | LVerb := TWMSysCommand(Message).CmdType; 244 | FMethodsDict.Items[LVerb].Method(FMethodsDict.Items[LVerb]); 245 | end 246 | else 247 | FOrgWndProc(Message); 248 | end 249 | else 250 | FOrgWndProc(Message); 251 | end; 252 | end; 253 | 254 | end. 255 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/Vcl.Styles.Utils.pas: -------------------------------------------------------------------------------- 1 | //************************************************************************************************** 2 | // 3 | // Unit Vcl.Styles.Utils 4 | // unit for the VCL Styles Utils 5 | // https://github.com/RRUZ/vcl-styles-utils/ 6 | // 7 | // The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); 8 | // you may not use this file except in compliance with the License. You may obtain a copy of the 9 | // License at http://www.mozilla.org/MPL/ 10 | // 11 | // Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 12 | // ANY KIND, either express or implied. See the License for the specific language governing rights 13 | // and limitations under the License. 14 | // 15 | // The Original Code is Vcl.Styles.Utils.pas. 16 | // 17 | // The Initial Developer of the Original Code is Rodrigo Ruz V. 18 | // Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2023 Rodrigo Ruz V. 19 | // All Rights Reserved. 20 | // 21 | //************************************************************************************************** 22 | unit Vcl.Styles.Utils; 23 | 24 | interface 25 | uses 26 | System.Classes, 27 | System.Generics.Collections, 28 | Vcl.Styles.Utils.Graphics, 29 | Vcl.Themes, 30 | Vcl.Styles.Ext; 31 | 32 | type 33 | TVCLStylesElement = (vseBitmaps, vseSysColors, vseStyleColors, vseStyleFontColors); 34 | TVCLStylesElements = set of TVCLStylesElement; 35 | TVCLStylesFilter = (vsfHSL, vsfRGB, vsfBlend, vsfTextureBlend); 36 | 37 | TVclStylesUtils = class 38 | private 39 | FClone: Boolean; 40 | FStream: TStream; 41 | FStyleExt: TCustomStyleExt; 42 | FElements: TVCLStylesElements; 43 | //FSourceInfo: TSourceInfo; 44 | public 45 | procedure SetFilters(Filters: TObjectList); 46 | procedure ApplyChanges; 47 | procedure SaveToFile(const FileName: string); 48 | //property SourceInfo: TSourceInfo read FSourceInfo; 49 | property StyleExt: TCustomStyleExt read FStyleExt; 50 | property Elements: TVCLStylesElements read FElements write FElements; 51 | constructor Create(const StyleName: string;Clone:Boolean=False); 52 | destructor Destroy;override; 53 | class procedure SaveSettings(const FileName:String;Elements :TVCLStylesElements; FilterType: TVCLStylesFilter;Filters: TObjectList); 54 | class procedure LoadSettings(const FileName:String;var Elements :TVCLStylesElements; var FilterType: TVCLStylesFilter;Filters: TObjectList); 55 | //class procedure LoadAndApplySettings(const FileName:String); 56 | end; 57 | 58 | const 59 | VCLStylesFilterNames: Array[TVCLStylesFilter] of string = ('HSL','RGB','Blend','Texture Blend'); 60 | 61 | implementation 62 | 63 | uses 64 | System.Rtti, 65 | System.IOUtils, 66 | System.SysUtils, 67 | Xml.XMLDoc, 68 | Xml.XMLIntf, 69 | Vcl.Graphics; 70 | 71 | 72 | { TVclStylesUtils } 73 | constructor TVclStylesUtils.Create(const StyleName: string;Clone:Boolean=False); 74 | var 75 | FSourceInfo: TSourceInfo; 76 | begin 77 | TStyleManager.StyleNames;//call DiscoverStyleResources 78 | FElements :=[vseBitmaps]; 79 | FClone :=Clone; 80 | FStyleExt:=nil; 81 | FStream :=nil; 82 | 83 | if (StyleName<>'') and (CompareText('Windows',StyleName)<>0) then 84 | begin 85 | if FClone then 86 | begin 87 | FStream:=TMemoryStream.Create; 88 | FSourceInfo:=TStyleManager.StyleSourceInfo[StyleName]; 89 | TStream(FSourceInfo.Data).Position:=0; 90 | FStream.CopyFrom(TStream(FSourceInfo.Data),TStream(FSourceInfo.Data).Size); 91 | //restore original index 92 | TStream(FSourceInfo.Data).Position:=0; 93 | FStream.Position:=0; 94 | end 95 | else 96 | FStream:=TStream(TStyleManager.StyleSourceInfo[StyleName].Data); 97 | FStyleExt:=TCustomStyleExt.Create(FStream); 98 | end; 99 | end; 100 | 101 | destructor TVclStylesUtils.Destroy; 102 | begin 103 | if Assigned(StyleExt) then 104 | StyleExt.Free; 105 | if FClone and Assigned(FStream) then 106 | FStream.Free; 107 | inherited; 108 | end; 109 | 110 | procedure TVclStylesUtils.ApplyChanges; 111 | begin 112 | if Assigned(StyleExt) then 113 | begin 114 | FStream.Size:=0; 115 | StyleExt.CopyToStream(FStream); 116 | FStream.Seek(0,soFromBeginning); 117 | end; 118 | end; 119 | 120 | class procedure TVclStylesUtils.SaveSettings(const FileName:String;Elements :TVCLStylesElements; FilterType: TVCLStylesFilter;Filters: TObjectList); 121 | var 122 | Doc: IXMLDocument; 123 | RootNode, ChildNode, oNode: IXMLNode; 124 | LFilter: TBitmapFilter; 125 | begin 126 | Doc :=TXMLDocument.Create(nil); 127 | try 128 | Doc.Active := True; 129 | Doc.Version :='1.0'; 130 | Doc.Encoding:='utf-8'; 131 | Doc.Options := [doNodeAutoIndent]; 132 | RootNode := Doc.AddChild('VCLStylesEQ'); 133 | RootNode.Attributes['created'] := FormatDateTime('YYYY-MM-DD HH:NN:SS',Now); 134 | RootNode.Attributes['vseBitmaps'] := BoolToStr({vseBitmaps in Elements}True, True); 135 | RootNode.Attributes['vseSysColors'] := BoolToStr(vseSysColors in Elements, True); 136 | RootNode.Attributes['vseStyleColors'] := BoolToStr(vseStyleColors in Elements, True); 137 | RootNode.Attributes['vseStyleFontColors'] := BoolToStr(vseStyleFontColors in Elements, True); 138 | ChildNode := RootNode.AddChild('FilterType'); 139 | ChildNode.Attributes['Name'] := VCLStylesFilterNames[FilterType]; 140 | 141 | for LFilter in Filters do 142 | begin 143 | oNode := ChildNode.AddChild(LFilter.ClassName); 144 | oNode.Text:=IntToStr(LFilter.ColorValue); 145 | end; 146 | Doc.SaveToFile(FileName); 147 | finally 148 | Doc:=nil; 149 | end; 150 | end; 151 | 152 | class procedure TVclStylesUtils.LoadSettings(const FileName:String;var Elements :TVCLStylesElements; var FilterType: TVCLStylesFilter;Filters: TObjectList); 153 | var 154 | Doc: IXMLDocument; 155 | RootNode, ChildNode, oNode: IXMLNode; 156 | LFilterType :TVCLStylesFilter; 157 | i: Integer; 158 | LClassName: string; 159 | Ctx: TRttiContext; 160 | RttiInstanceType: TRttiInstanceType; 161 | Value: TValue; 162 | begin 163 | Doc :=LoadXMLDocument(FileName); 164 | try 165 | RootNode :=Doc.DocumentElement; 166 | 167 | Elements:=[]; 168 | if SameText(RootNode.Attributes['vseBitmaps'],'True') then 169 | Elements:=Elements+[vseBitmaps]; 170 | 171 | if SameText(RootNode.Attributes['vseSysColors'],'True') then 172 | Elements:=Elements+[vseSysColors]; 173 | 174 | if SameText(RootNode.Attributes['vseStyleColors'],'True') then 175 | Elements:=Elements+[vseStyleColors]; 176 | 177 | if SameText(RootNode.Attributes['vseStyleFontColors'],'True') then 178 | Elements:=Elements+[vseStyleFontColors]; 179 | 180 | ChildNode:=RootNode.ChildNodes[0]; 181 | for LFilterType:=Low(TVCLStylesFilter) to High(TVCLStylesFilter) do 182 | if SameText(VCLStylesFilterNames[LFilterType], ChildNode.Attributes['Name']) then 183 | begin 184 | FilterType:=LFilterType; 185 | break; 186 | end; 187 | 188 | for i:=0 to ChildNode.ChildNodes.Count-1 do 189 | begin 190 | oNode:= ChildNode.ChildNodes[i]; 191 | LClassName:='uHSLUtils.'+oNode.NodeName; 192 | RttiInstanceType := (Ctx.FindType(LClassName) as TRttiInstanceType); 193 | Value := RttiInstanceType.GetMethod('Create').Invoke(RttiInstanceType.MetaclassType,[StrToInt(oNode.Text)]); 194 | Filters.Add((Value.AsObject as TBitmapFilter)); 195 | end; 196 | finally 197 | Doc:=nil; 198 | end; 199 | end; 200 | 201 | procedure TVclStylesUtils.SaveToFile(const FileName: string); 202 | var 203 | FileStream: TFileStream; 204 | begin 205 | if FileName<>'' then 206 | begin 207 | FileStream:=TFile.Create(FileName); 208 | try 209 | StyleExt.CopyToStream(FileStream); 210 | finally 211 | FileStream.Free; 212 | end; 213 | end; 214 | end; 215 | 216 | procedure TVclStylesUtils.SetFilters(Filters: TObjectList); 217 | var 218 | LBitmap: TBitmap; 219 | BitmapList: TObjectList; 220 | Index: Integer; 221 | Filter: TBitmapFilter; 222 | Element: TIdentMapEntry; 223 | LColor: TColor; 224 | StyleColor: TStyleColor; 225 | StyleFont: TStyleFont; 226 | begin 227 | if vseBitmaps in FElements then 228 | begin 229 | BitmapList:=StyleExt.BitmapList; 230 | try 231 | Index:=0; 232 | for LBitmap in BitmapList do 233 | begin 234 | for Filter in Filters do 235 | Filter.ProcessBitmap(LBitmap); 236 | StyleExt.ReplaceBitmap(Index, LBitmap); 237 | Inc(Index); 238 | end; 239 | finally 240 | BitmapList.Free; 241 | end; 242 | end; 243 | 244 | if vseSysColors in FElements then 245 | begin 246 | for Element in VclStyles_SysColors do 247 | begin 248 | LColor:=StyleExt.GetSystemColor(Element.Value); 249 | for Filter in Filters do 250 | LColor:=Filter.ProcessColor(LColor); 251 | 252 | StyleExt.SetSystemColor(Element.Value,LColor); 253 | end; 254 | end; 255 | 256 | if vseStyleColors in FElements then 257 | begin 258 | for StyleColor := Low(TStyleColor) to High(TStyleColor) do 259 | begin 260 | LColor:=StyleExt.GetStyleColor(StyleColor); 261 | for Filter in Filters do 262 | LColor:=Filter.ProcessColor(LColor); 263 | 264 | StyleExt.SetStyleColor(StyleColor, LColor); 265 | end; 266 | end; 267 | 268 | if vseStyleFontColors in FElements then 269 | begin 270 | for StyleFont := Low(TStyleFont) to High(TStyleFont) do 271 | begin 272 | LColor:=StyleExt.GetStyleFontColor(StyleFont); 273 | for Filter in Filters do 274 | LColor:=Filter.ProcessColor(LColor); 275 | 276 | StyleExt.SetStyleFontColor(StyleFont, LColor); 277 | end; 278 | end; 279 | end; 280 | 281 | end. 282 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/fontawesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Ext/VCLStyleUtils/Common/fontawesome.ttf -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/Common/fontawesome.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/Ext/VCLStyleUtils/Common/fontawesome.zip -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/DDetours/Source/CPUID.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // CPUID for Delphi. 3 | // Unit CPUID 4 | // https://github.com/MahdiSafsafi/DDetours 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License, v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at 9 | // https://mozilla.org/MPL/2.0/. 10 | // ************************************************************************************************** 11 | 12 | unit CPUID; 13 | {$IFDEF FPC} 14 | {$MODE DELPHI} 15 | {$WARN 4055 OFF} 16 | {$WARN 4082 OFF} 17 | {$WARN 5057 OFF} 18 | {$ENDIF FPC} 19 | 20 | interface 21 | 22 | {$I DDetoursDefs.inc} 23 | 24 | uses 25 | SysUtils 26 | {$IFNDEF FPC}, LegacyTypes{$ENDIF FPC} 27 | ; 28 | 29 | type 30 | { Do not change registers order ! } 31 | TCPUIDStruct = packed record 32 | rEAX: Cardinal; { EAX Register } 33 | rEBX: Cardinal; { EBX Register } 34 | rEDX: Cardinal; { EDX Register } 35 | rECX: Cardinal; { ECX Register } 36 | end; 37 | 38 | PCPUIDStruct = ^TCPUIDStruct; 39 | 40 | procedure CallCPUID(ID: NativeUInt; var CPUIDStruct: TCPUIDStruct); 41 | function IsCPUIDSupported(): Boolean; 42 | 43 | type 44 | TCPUVendor = (vUnknown, vIntel, vAMD, vNextGen); 45 | TCPUEncoding = set of (REX, VEX, EVEX); 46 | TCPUInstructions = set of (iMultiNop); 47 | 48 | var 49 | CPUVendor: TCPUVendor; 50 | CPUEncoding: TCPUEncoding; 51 | CPUInsts: TCPUInstructions; 52 | 53 | implementation 54 | 55 | var 56 | CPUIDSupported: Boolean = False; 57 | 58 | function ___IsCPUIDSupported: Boolean; 59 | asm 60 | {$IFDEF CPUX64} 61 | PUSH RCX 62 | MOV RCX,RCX 63 | PUSHFQ 64 | POP RAX 65 | MOV RCX, RAX 66 | XOR RAX, $200000 67 | PUSH RAX 68 | POPFQ 69 | PUSHFQ 70 | POP RAX 71 | XOR RAX, RCX 72 | SHR RAX, 21 73 | AND RAX, 1 74 | PUSH RCX 75 | POPFQ 76 | POP RCX 77 | {$ELSE !CPUX64} 78 | 79 | PUSH ECX 80 | PUSHFD 81 | POP EAX { EAX = EFLAGS } 82 | MOV ECX, EAX { Save the original EFLAGS value . } 83 | { 84 | CPUID is supported only if we can modify 85 | bit 21 of EFLAGS register ! 86 | } 87 | XOR EAX, $200000 88 | PUSH EAX 89 | POPFD { Set the new EFLAGS value } 90 | PUSHFD 91 | POP EAX { Read EFLAGS } 92 | { 93 | Check if the 21 bit was modified ! 94 | If so ==> Return True . 95 | else ==> Return False. 96 | } 97 | XOR EAX, ECX 98 | SHR EAX, 21 99 | AND EAX, 1 100 | PUSH ECX 101 | POPFD { Restore original EFLAGS value . } 102 | POP ECX 103 | {$ENDIF CPUX64} 104 | end; 105 | 106 | procedure ___CallCPUID(const ID: NativeInt; var CPUIDStruct); 107 | asm 108 | { 109 | ALL REGISTERS (rDX,rCX,rBX) MUST BE SAVED BEFORE 110 | EXECUTING CPUID INSTRUCTION ! 111 | } 112 | {$IFDEF CPUX64} 113 | PUSH R9 114 | PUSH RBX 115 | PUSH RDX 116 | MOV RAX,RCX 117 | MOV R9,RDX 118 | CPUID 119 | {$IFNDEF FPC} 120 | MOV R9.TCPUIDStruct.rEAX,EAX 121 | MOV R9.TCPUIDStruct.rEBX,EBX 122 | MOV R9.TCPUIDStruct.rECX,ECX 123 | MOV R9.TCPUIDStruct.rEDX,EDX 124 | {$ELSE FPC} 125 | MOV [R9].TCPUIDStruct.rEAX,EAX 126 | MOV [R9].TCPUIDStruct.rEBX,EBX 127 | MOV [R9].TCPUIDStruct.rECX,ECX 128 | MOV [R9].TCPUIDStruct.rEDX,EDX 129 | {$ENDIF !FPC} 130 | POP RDX 131 | POP RBX 132 | POP R9 133 | {$ELSE !CPUX64} 134 | 135 | PUSH EDI 136 | PUSH ECX 137 | PUSH EBX 138 | MOV EDI,EDX 139 | CPUID 140 | {$IFNDEF FPC} 141 | MOV EDI.TCPUIDStruct.rEAX,EAX 142 | MOV EDI.TCPUIDStruct.rEBX,EBX 143 | MOV EDI.TCPUIDStruct.rECX,ECX 144 | MOV EDI.TCPUIDStruct.rEDX,EDX 145 | {$ELSE FPC} 146 | MOV [EDI].TCPUIDStruct.rEAX,EAX 147 | MOV [EDI].TCPUIDStruct.rEBX,EBX 148 | MOV [EDI].TCPUIDStruct.rECX,ECX 149 | MOV [EDI].TCPUIDStruct.rEDX,EDX 150 | {$ENDIF !FPC} 151 | POP EBX 152 | POP ECX 153 | POP EDI 154 | {$ENDIF CPUX64} 155 | end; 156 | 157 | function ___IsAVXSupported: Boolean; 158 | asm 159 | { 160 | Checking for AVX support requires 3 steps: 161 | 162 | 1) Detect CPUID.1:ECX.OSXSAVE[bit 27] = 1 163 | => XGETBV enabled for application use 164 | 165 | 2) Detect CPUID.1:ECX.AVX[bit 28] = 1 166 | => AVX instructions supported. 167 | 168 | 3) Issue XGETBV and verify that XCR0[2:1] = ‘11b’ 169 | => XMM state and YMM state are enabled by OS. 170 | 171 | } 172 | 173 | { Steps : 1 and 2 } 174 | {$IFDEF CPUX64} 175 | MOV RAX, 1 176 | PUSH RCX 177 | PUSH RBX 178 | PUSH RDX 179 | {$ELSE !CPUX64} 180 | MOV EAX, 1 181 | PUSH ECX 182 | PUSH EBX 183 | PUSH EDX 184 | {$ENDIF CPUX64} 185 | CPUID 186 | AND ECX, $018000000 187 | CMP ECX, $018000000 188 | JNE @@NOT_SUPPORTED 189 | XOR ECX,ECX 190 | { 191 | Delphi does not support XGETBV ! 192 | => We need to use the XGETBV opcodes ! 193 | } 194 | DB $0F DB $01 DB $D0 // XGETBV 195 | { Step :3 } 196 | AND EAX, $06 197 | CMP EAX, $06 198 | JNE @@NOT_SUPPORTED 199 | MOV EAX, 1 200 | JMP @@END 201 | @@NOT_SUPPORTED: 202 | XOR EAX,EAX 203 | @@END: 204 | {$IFDEF CPUX64} 205 | POP RDX 206 | POP RBX 207 | POP RCX 208 | {$ELSE !CPUX64} 209 | POP EDX 210 | POP EBX 211 | POP ECX 212 | {$ENDIF CPUX64} 213 | end; 214 | 215 | procedure CallCPUID(ID: NativeUInt; var CPUIDStruct: TCPUIDStruct); 216 | begin 217 | FillChar(CPUIDStruct, SizeOf(TCPUIDStruct), #0); 218 | if not CPUIDSupported then 219 | raise Exception.Create('CPUID instruction not supported.') 220 | else 221 | ___CallCPUID(ID, CPUIDStruct); 222 | end; 223 | 224 | function IsCPUIDSupported: Boolean; 225 | begin 226 | Result := CPUIDSupported; 227 | end; 228 | 229 | type 230 | TVendorName = array [0 .. 12] of AnsiChar; 231 | 232 | function GetVendorName(): TVendorName; 233 | var 234 | Info: PCPUIDStruct; 235 | P: PByte; 236 | begin 237 | Result := ''; 238 | if not IsCPUIDSupported then 239 | Exit; 240 | Info := GetMemory(SizeOf(TCPUIDStruct)); 241 | CallCPUID(0, Info^); 242 | P := PByte(NativeInt(Info) + 4); // Skip EAX ! 243 | Move(P^, PByte(@Result[0])^, 12); 244 | FreeMemory(Info); 245 | end; 246 | 247 | procedure __Init__; 248 | var 249 | vn: TVendorName; 250 | Info: TCPUIDStruct; 251 | r: Cardinal; 252 | begin 253 | CPUVendor := vUnknown; 254 | {$IFDEF CPUX64} 255 | CPUEncoding := [REX]; 256 | {$ELSE !CPUX64} 257 | CPUEncoding := []; 258 | {$ENDIF CPUX64} 259 | CPUInsts := []; 260 | if IsCPUIDSupported then 261 | begin 262 | vn := GetVendorName(); 263 | if vn = 'GenuineIntel' then 264 | CPUVendor := vIntel 265 | else if vn = 'AuthenticAMD' then 266 | CPUVendor := vAMD 267 | else if vn = 'NexGenDriven' then 268 | CPUVendor := vNextGen; 269 | CallCPUID(1, Info); 270 | r := Info.rEAX and $F00; 271 | case r of 272 | $F00, $600: 273 | Include(CPUInsts, iMultiNop); 274 | end; 275 | if ___IsAVXSupported then 276 | Include(CPUEncoding, VEX); 277 | end; 278 | end; 279 | 280 | initialization 281 | 282 | CPUIDSupported := ___IsCPUIDSupported; 283 | __Init__; 284 | 285 | end. 286 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/DDetours/Source/DDetoursDefs.inc: -------------------------------------------------------------------------------- 1 | {.$DEFINE HOOK_INTERNAL_FUNCTIONS} // hook internal functions. 2 | 3 | {$IFDEF FPC} 4 | {$ASMMODE INTEL} 5 | {$ELSE !FPC} 6 | 7 | {$T-} 8 | 9 | {$IF CompilerVersion >= 17.0} 10 | {$DEFINE DELPHI_2005_UP} 11 | {$IFEND} 12 | 13 | {$IF CompilerVersion >= 18.5} 14 | {$DEFINE DELPHI_2007_UP} 15 | {$IFEND} 16 | 17 | {$IF CompilerVersion >= 20} 18 | {$DEFINE DELPHI_2009_UP} 19 | {$IFEND} 20 | 21 | {$IF CompilerVersion >= 21} 22 | {$DEFINE DELPHI_2010_UP} 23 | {$IFEND} 24 | 25 | {$IF CompilerVersion >= 22} 26 | {$DEFINE DELPHI_XE_UP} 27 | {$IFEND} 28 | 29 | {$IF CompilerVersion >= 23} 30 | {$DEFINE DELPHI_XE2_UP} 31 | {$IFEND} 32 | 33 | {$IF CompilerVersion >= 33} 34 | {$DEFINE DELPHI_RIO_UP} 35 | {$IFEND} 36 | 37 | {$IFDEF DELPHI_2005_UP} 38 | {$DEFINE SUPPORTS_INLINE} 39 | {$ENDIF} 40 | 41 | {$IFDEF DELPHI_XE2_UP} 42 | {$DEFINE SUPPORTS_RTTI} 43 | {$DEFINE SUPPORTS_GENERICS} 44 | {$DEFINE RENAMED_NAMESPACE} 45 | {$ENDIF} 46 | 47 | {$ENDIF FPC} 48 | 49 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/DDetours/Source/LegacyTypes.pas: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // 3 | // https://github.com/MahdiSafsafi/DDetours 4 | // 5 | // ************************************************************************************************** 6 | 7 | unit LegacyTypes; 8 | 9 | interface 10 | 11 | {$I DDetoursDefs.inc} 12 | 13 | type 14 | 15 | {$IFNDEF FPC} 16 | {$IFNDEF DELPHI_XE_UP} 17 | NativeInt = Integer; 18 | NativeUInt = Cardinal; 19 | PNativeInt = ^NativeInt; 20 | PNativeUInt = ^NativeUInt; 21 | {$IFDEF MSWINDOWS} 22 | TThreadID = LongWord; 23 | {$ENDIF MSWINDOWS} 24 | {$ENDIF DELPHI_XE_UP} 25 | {$ENDIF FPC} 26 | Int8 = Shortint; 27 | Int16 = Smallint; 28 | Int32 = Integer; 29 | 30 | UInt8 = Byte; 31 | UInt16 = Word; 32 | UInt32 = Cardinal; 33 | 34 | PInt8 = ^Int8; 35 | PInt16 = ^Int16; 36 | PInt32 = ^Int32; 37 | PInt64 = ^Int64; 38 | 39 | PUInt8 = ^UInt8; 40 | PUInt16 = ^UInt16; 41 | PUInt32 = ^UInt32; 42 | PUInt64 = ^UInt64; 43 | 44 | SIZE_T = NativeUInt; 45 | 46 | implementation 47 | 48 | end. 49 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/DDetours/Source/ModRmFlagsTables.inc: -------------------------------------------------------------------------------- 1 | // ************************************************************************************************** 2 | // Part of x86 Instruction Decode Library [InstDecode] 3 | // 4 | // https://github.com/MahdiSafsafi/DDetours 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License, v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at 9 | // https://mozilla.org/MPL/2.0/. 10 | // ************************************************************************************************** 11 | 12 | 13 | { Reference : Intel® 64 and IA-32 Architectures Software Developer’s Manual Vol 2 } 14 | 15 | type 16 | TModRmFlagsArray = array [Byte] of Byte; 17 | PModRmFlagsArray = ^TModRmFlagsArray; 18 | { 19 | ModRMFlags : 20 | Bits:4 3 2 1 0 . 21 | 22 | Bit 0 : Set ==> Register Indirect Addressing Mode . 23 | Bit 1 : Set ==> Displacement 8 bit . 24 | Bit 2 : Set ==> Displacement 16 bit . 25 | Bit 3 : Set ==> Displacement 32 bit. 26 | Bit 4 : Set ==> SIB Used . 27 | 28 | 29 | Values: 30 | 31 | $00 ==> Register . 32 | $01 ==> Register Indirect Addressing Mode with No Displacement . 33 | $03 ==> Register Indirect Addressing Mode + 8 bit Displacement . 34 | $04 ==> 16 bit Displacement only without register . 35 | $05 ==> Register Indirect Addressing Mode + 16 bit Displacement . 36 | $08 ==> 32 bit Displacement only without register . 37 | $09 ==> Register Indirect Addressing Mode + 32 bit Displacement . 38 | $11 ==> Register Indirect Addressing Mode + SIB . 39 | $13 ==> Register Indirect Addressing Mode + SIB + 8 bit Displacement . 40 | $19 ==> Register Indirect Addressing Mode + SIB + 32 bit Displacement . 41 | 42 | } 43 | 44 | const 45 | 46 | ModRM16Flags: TModRmFlagsArray = ( 47 | { => Mod=00b <= } 48 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 49 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 50 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 51 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 52 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 53 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 54 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 55 | $01, $01, $01, $01, $01, $01, $04, $01, { 00 } 56 | { => Mod=01b <= } 57 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 58 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 59 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 60 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 61 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 62 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 63 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 64 | $03, $03, $03, $03, $03, $03, $03, $03, { 01 } 65 | { => Mod=10b <= } 66 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 67 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 68 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 69 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 70 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 71 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 72 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 73 | $05, $05, $05, $05, $05, $05, $05, $05, { 10 } 74 | { => Mod=11b <= } 75 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 76 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 77 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 78 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 79 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 80 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 81 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 82 | $00, $00, $00, $00, $00, $00, $00, $00 { 11 } 83 | 84 | ); 85 | ModRM32Flags: TModRmFlagsArray = ( 86 | { => Mod=00b <= } 87 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 88 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 89 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 90 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 91 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 92 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 93 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 94 | $01, $01, $01, $01, $11, $08, $01, $01, { 00 } 95 | { => Mod=01b <= } 96 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 97 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 98 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 99 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 100 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 101 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 102 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 103 | $03, $03, $03, $03, $13, $03, $03, $03, { 01 } 104 | { => Mod=10b <= } 105 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 106 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 107 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 108 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 109 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 110 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 111 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 112 | $09, $09, $09, $09, $19, $09, $09, $09, { 10 } 113 | { => Mod=11b <= } 114 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 115 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 116 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 117 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 118 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 119 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 120 | $00, $00, $00, $00, $00, $00, $00, $00, { 11 } 121 | $00, $00, $00, $00, $00, $00, $00, $00 { 11 } 122 | 123 | ); 124 | 125 | ModRmFlags: array [0 .. 3] of PModRmFlagsArray = ( // 126 | nil, 127 | @ModRM16Flags, { AddrMode 16-bits } 128 | @ModRM32Flags, { AddrMode 32-bits } 129 | @ModRM32Flags { AddrMode 64-bits } 130 | ); -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/DDetours/Source/TlHelp32.inc: -------------------------------------------------------------------------------- 1 | { TlHelp32 types for fpc } 2 | 3 | const 4 | TH32CS_SNAPHEAPLIST = $00000001; 5 | TH32CS_SNAPPROCESS = $00000002; 6 | TH32CS_SNAPTHREAD = $00000004; 7 | TH32CS_SNAPMODULE = $00000008; 8 | TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST or TH32CS_SNAPPROCESS or 9 | TH32CS_SNAPTHREAD or TH32CS_SNAPMODULE; 10 | TH32CS_INHERIT = $80000000; 11 | 12 | TLS_OUT_OF_INDEXES = DWORD($FFFFFFFF); // FPC does not declare TLS_OUT_OF_INDEXES. 13 | 14 | type 15 | tagTHREADENTRY32 = record 16 | dwSize: DWORD; 17 | cntUsage: DWORD; 18 | th32ThreadID: DWORD; 19 | th32OwnerProcessID: DWORD; 20 | tpBasePri: Longint; 21 | tpDeltaPri: Longint; 22 | dwFlags: DWORD; 23 | end; 24 | THREADENTRY32 = tagTHREADENTRY32; 25 | PTHREADENTRY32 = ^tagTHREADENTRY32; 26 | LPTHREADENTRY32 = ^tagTHREADENTRY32; 27 | TThreadEntry32 = tagTHREADENTRY32; 28 | 29 | TThread32First = function (hSnapshot: THandle; var lpte: TThreadEntry32): BOOL stdcall; 30 | TThread32Next = function (hSnapshot: THandle; var lpte: TThreadENtry32): BOOL stdcall; 31 | TCreateToolhelp32Snapshot = function (dwFlags, th32ProcessID: DWORD): THandle; stdcall; 32 | -------------------------------------------------------------------------------- /Ext/VCLStyleUtils/README.md: -------------------------------------------------------------------------------- 1 | ![Lang](https://img.shields.io/github/languages/top/RRUZ/vcl-styles-utils.svg) 2 | ![Contrib](https://img.shields.io/github/contributors/RRUZ/vcl-styles-utils.svg) 3 | ![LastCommit](https://img.shields.io/github/last-commit/RRUZ/vcl-styles-utils.svg) 4 | ![Follow](https://img.shields.io/twitter/follow/RRUZ.svg?style=social) 5 | # VCL Styles Utils # 6 | 7 | The *VCL Styles Utils* is a Delphi library which extend the [RAD Studio VCL Styles](http://docwiki.embarcadero.com/RADStudio/en/VCL_Styles_Overview), adding unique features like the support for [Classic and New Common dialogs](https://github.com/RRUZ/vcl-styles-utils/wiki/VclStylesSysControls), [Task Dialogs](https://github.com/RRUZ/vcl-styles-utils/wiki/VCLStylesUxTheme), Styling of [popup and shell menus](https://github.com/RRUZ/vcl-styles-utils/wiki/VCLStylesMenus), [Non client area](https://github.com/RRUZ/vcl-styles-utils/wiki/VclStylesNC) components and much more. 8 | 9 |

10 | Mix 11 |

12 | 13 | ## Features ## 14 |
    15 |
  • Works in Delphi XE2-XE8, 10 Seattle, 10.1 Berlin, 10.2 Tokyo, 10.3 Rio, 10.4 Sydney
  • 16 |
  • Vcl.Styles.Ext unit extended the VCL Styles adding new properties and methods to list, remove and reload VCL Styles.
  • 17 |
  • Vcl.Styles.Utils unit, allows modify the VCL Styles manipulating the visual elements and fonts colors.
  • 18 |
  • TNCControls component which allow you add controls to the Non Client area of the form
  • 19 |
20 | 21 | ![https://github.com/RRUZ/vcl-styles-utils/blob/master/images/NCButtonsMain.png](https://github.com/RRUZ/vcl-styles-utils/blob/master/images/NCButtonsMain.png) 22 | 23 |
    24 |
  • Vcl.Styles.WebBrowser unit, add support for style the scrollbars and dialogs of the TWebBrowser component.
  • 25 |
26 | 27 | ![https://github.com/RRUZ/vcl-styles-utils/blob/master/images/WebBrowserStyledMain.png](https://github.com/RRUZ/vcl-styles-utils/blob/master/images/WebBrowserStyledMain.png) 28 | 29 | 32 | 33 | ![https://github.com/RRUZ/vcl-styles-utils/blob/master/images/VCLStyles%20PopUp/Menu.png](https://github.com/RRUZ/vcl-styles-utils/blob/master/images/Menu.png) 34 | 35 | 38 | 39 | ![https://github.com/RRUZ/vcl-styles-utils/blob/master/images/DialogsMain.png](https://github.com/RRUZ/vcl-styles-utils/blob/master/images/DialogsMain.png) 40 | 41 |
    42 |
  • Vcl.Styles.FormStyleHooks unit add support for use images and solid colors in the title and background of the TForms.
  • 43 |
44 | 45 | ![https://github.com/RRUZ/vcl-styles-utils/blob/master/images/FormHooksMain.png](https://github.com/RRUZ/vcl-styles-utils/blob/master/images/FormHooksMain.png) 46 | 47 | 50 | 51 | ![https://github.com/RRUZ/vcl-styles-utils/blob/master/images/TaskDialogs2.png](https://github.com/RRUZ/vcl-styles-utils/blob/master/images/TaskDialogs2.png) 52 | 53 | 60 | 61 | ## Installation ## 62 | 63 |
    64 |
  • Unzip or checkout the files of the library in a writable folder.
  • 65 |
  • Under Tools, Environment Options, Library, add the directory where the VCL Styles Utils library have been installed Example : C:\Delphi\Libs\vcl-styles-utils\Common to the Win32 and Win64 library path. 66 |
  • 67 |
68 | 69 | **Note** : If you want to use the Vcl.Styles.Hooks unit you must also include the [Delphi Detours Library](https://github.com/MahdiSafsafi/delphi-detours-library) files in your lib/search path Example : *C:\Delphi\Libs\vcl-styles-utils\Common\delphi-detours-library* 70 | 71 | -------------------------------------------------------------------------------- /README.htm: -------------------------------------------------------------------------------- 1 | 32 |

VCLThemeSelector License

33 |

Easy and elegant preview/selection of Theme (Light or Dark) for VCL apps plus HighDPI demo

34 |

Related links: https://www.embarcadero.com/ - https://learndelphi.org/

35 |

With VCLThemeSelector you can easily add a modern and elegant Theme selector for your Delphi VCL app. The Form shows all the VCL Styles included in your application, then arrange them in defined Rows and Columns. You can specify to include or not 'Windows' not-styled option.

36 |

Preview (from Delphi 10.4 to Delphi 12 - using PerControlStyles)

37 |

/Demo/Images/PreviewD10_4.jpg

38 |

Preview (before Delphi 10.3 - Without PerControlStyle)

39 |

/Demo/Images/PreviewD10_3.jpg

40 |

Use the VCLThemeSelectorLauncher demo present in Demo Folder to test it, and see how it's easy to use it, like in this example:

41 |
var
 42 |   LStyleName: string;
 43 |   LExcludeWindows: boolean;
 44 |   LMaxRows, LMaxCols: Integer;
 45 | begin  
 46 |   LStyleName := TStyleManager.ActiveStyle.Name;
 47 |   LExcludeWindows := False;
 48 |   LMaxRows := 3;
 49 |   LMaxCols := 4;
 50 |   if ShowVCLThemeSelector(LStyleName, LExcludeWindows, LMaxRows, LMaxCols) then
 51 |     TStyleManager.SetStyle(LStyleName);
 52 | end;    
 53 | 
54 |

License: the CBVCLStylePreview is based on VCLStylePreview (Vcl.Styles.Ext) from: 55 | github.com/RRUZ/vcl-styles-utils with full High-DPI support, and released under Apache 2.0 license.

56 |

High-DPI Delphi App full example

57 |

Also included in this repository you can find a full example of an HighDPI - VCL Themed enabled application that uses the VCLThemeSelector to change the Theme. You can run the demo from: Demo\Bin\ModernAppDemo.exe.

58 |

Preview ( Delphi 12 and Windows 11 Modern Dark Style)

59 |

/Demo/Images/DemoPreviewD11_Dark.jpg

60 |

Preview ( Delphi 12 and Windows 11 Modern Light Style)

61 |

/Demo/Images/DemoPreview_D11_Light.jpg

62 |

Demo from 10.1 to 10.3 (with SVGIconsImageList)

63 |

/Demo/Images/DemoPreview.jpg

64 |

Demo with Delphi 12 (with PerControlStyle and IconFontsImageList)

65 |

/Demo/Images/DemoPreviewD10_4.jpg

66 |

WARNING: to edit and compile the demo you must first download: 67 | IconFontsImageList free components here… and SVGIconImageList free components here…

68 |

You can also use StyledComponents, enabling STYLEDCOMPONENTS Compiler directive in the Demo. You must first download StyledComponents here…

69 |

Preview using StyledComponents with Rounded Buttons

70 |

/Demo/Images/DemoPreviewStyledComponents.jpg

71 |

License

72 |

this Demo is inspired by TSplitView demo (original software is Copyright (c) 2015 Embarcadero Technologies, Inc.) and is released under Apache 2.0 license.

73 |

Delphi Support

74 |

Compatibility

75 |

VCLThemeSelector and VCLThemeSelectorLauncher are compatible from Delphi XE5 to 12, with some differences to High-DPI support.

76 |

ModernAppDemo is compatible with Delphi Delphi 12, 11, 10.4, 10.3, 10.2 and 10.1 (notice: 10.1 png stream format of pictures inside biolife.xml are incompatible: use an old biolife.xml file).

77 |

Release Notes

78 |

20 Nov 2024

79 |
    80 |
  • Added support for Delphi 12.2
  • 81 |
  • Fixed Font Loading fron Registry in DemoApp
  • 82 |
83 |

26 Apr 2024

84 |
    85 |
  • Added support for Delphi 12.1
  • 86 |
  • Added StyledComponents integration
  • 87 |
  • Added StyledComponents interposer in demo
  • 88 |
89 |

20 Oct 2023

90 |
    91 |
  • Added support for Delphi 12
  • 92 |
  • Examples Built with Delphi 12 (beta)
  • 93 |
94 |

04 Mar 2023

95 |
    96 |
  • Built with Delphi 11.3
  • 97 |
  • More VCL Styles supported
  • 98 |
99 |

15 Sep 2022

100 |
    101 |
  • Built with Delphi 11.2
  • 102 |
103 |

10 Apr 2022

104 |
    105 |
  • Built with Delphi 11.1
  • 106 |
  • Fixed Size of menu when resize icons
  • 107 |
108 |

16 Feb 2022

109 |
    110 |
  • Added italian translation
  • 111 |
  • SetEditorStyleAttributes to assign required/readonly attributes to edit controls
  • 112 |
  • Added pixelsperinch when storing font
  • 113 |
  • Added RegisterThemeAttributes to interface to add personal Styles
  • 114 |
115 |

19 Oct 2021

116 |
    117 |
  • Replaced “Windows11 Light” and “Windows11 Dark” Styles with “Windows11 Modern Light” and “Windows11 Modern Dark”
  • 118 |
  • Updated demos to use new Windows 11 Styles available from Get-It
  • 119 |
120 |

16 Oct 2021

121 |
    122 |
  • Added New Windows11 Light and Dark Themes to Modern Demo (Delphi 11)
  • 123 |
  • Added New Windows11 Light and Dark Themes to Launcher (Delphi 11)
  • 124 |
125 |

23 Aug 2021

126 |
    127 |
  • Added support for Delphi 11
  • 128 |
129 |

24 Jan 2021

130 |
    131 |
  • Changed preview to separate Light and Dark Themes
  • 132 |
  • Added support for info about Themes: 133 | TThemeAttribute = class 134 | StyleName: String; 135 | ThemeType: TThemeType; 136 | EditRequiredColor: TColor; 137 | EditReadonlyColor: TColor; 138 | end;
  • 139 |
140 |

30 Aug 2020

141 |
    142 |
  • Changed demo to use new IconsFontsVirtualImageList and SVGIconVirtualImageList components
  • 143 |
  • Updated external project VCLStyleUtils
  • 144 |
145 |

19 Jun 2020

146 |
    147 |
  • Fixed VCLThemeSelector for app in “Windows” Style for D10.4
  • 148 |
  • Recompiled Demo with IconFontsImageList 2.0 (with GDI+ support)
  • 149 |
150 |

11 Jun 2020

151 |
    152 |
  • Added SVGIconImageList
  • 153 |
  • Demo: swith icons from Fonts to SVG
  • 154 |
155 |

09 Jun 2020

156 |
    157 |
  • Updated Demo for Delphi 10.4
  • 158 |
  • Added custom form “per-control styled” for D10.4
  • 159 |
160 |

17 May 2020

161 |
    162 |
  • Changed “Material Design Desktop” Font used in Demo
  • 163 |
164 |

27 Apr 2020

165 |
    166 |
  • Added VCLThemeSelectorLauncher
  • 167 |
168 |

25 Apr 2020

169 |
    170 |
  • First release of Selector and Demo App
  • 171 |
172 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VCLThemeSelector [![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0) 2 | 3 | **Easy and elegant preview/selection of Theme (Light or Dark) for VCL apps plus HighDPI demo** 4 | 5 | Related links: https://www.embarcadero.com/ - https://learndelphi.org/ 6 | 7 | With **VCLThemeSelector** you can easily add a modern and elegant Theme selector for your Delphi VCL app. The Form shows all the VCL Styles included in your application, then arrange them in defined Rows and Columns. You can specify to include or not 'Windows' not-styled option. 8 | 9 | ### Preview (from Delphi 10.4 to Delphi 12 - using PerControlStyles) 10 | ![/Demo/Images/PreviewD10_4.jpg](./Demo/Images/PreviewD10_4.jpg) 11 | 12 | ### Preview (before Delphi 10.3 - Without PerControlStyle) 13 | ![/Demo/Images/PreviewD10_3.jpg](./Demo/Images/PreviewD10_3.jpg) 14 | 15 | Use the **VCLThemeSelectorLauncher** demo present in Demo Folder to test it, and see how it's easy to use it, like in this example: 16 | 17 | ```pascal 18 | var 19 | LStyleName: string; 20 | LExcludeWindows: boolean; 21 | LMaxRows, LMaxCols: Integer; 22 | begin 23 | LStyleName := TStyleManager.ActiveStyle.Name; 24 | LExcludeWindows := False; 25 | LMaxRows := 3; 26 | LMaxCols := 4; 27 | if ShowVCLThemeSelector(LStyleName, LExcludeWindows, LMaxRows, LMaxCols) then 28 | TStyleManager.SetStyle(LStyleName); 29 | end; 30 | ``` 31 | 32 | License: the CBVCLStylePreview is based on VCLStylePreview (Vcl.Styles.Ext) from: 33 | [github.com/RRUZ/vcl-styles-utils](https://github.com/RRUZ/vcl-styles-utils/) with full High-DPI support, and released under Apache 2.0 license. 34 | 35 | ## High-DPI Delphi App full example ## 36 | 37 | Also included in this repository you can find a full example of an HighDPI - VCL Themed enabled application that uses the VCLThemeSelector to change the Theme. You can run the demo from: Demo\Bin\ModernAppDemo.exe. 38 | 39 | ### Preview ( Delphi 12 and Windows 11 Modern Dark Style) 40 | ![/Demo/Images/DemoPreviewD11_Dark.jpg](./Demo/Images/DemoPreviewD11_Dark.jpg) 41 | 42 | ### Preview ( Delphi 12 and Windows 11 Modern Light Style) 43 | ![/Demo/Images/DemoPreview_D11_Light.jpg](/Demo/Images/DemoPreview_D11_Light.jpg) 44 | 45 | ### Demo from 10.1 to 10.3 (with SVGIconsImageList) 46 | ![/Demo/Images/DemoPreview.jpg](./Demo/Images/DemoPreview.jpg) 47 | 48 | ### Demo with Delphi 12 (with PerControlStyle and IconFontsImageList) 49 | ![/Demo/Images/DemoPreviewD10_4.jpg](./Demo/Images/DemoPreviewD10_4.jpg) 50 | 51 | WARNING: to edit and compile the demo you must first download: 52 | IconFontsImageList free components [here...](https://github.com/EtheaDev/IconFontsImageList/) and SVGIconImageList free components [here...](https://github.com/EtheaDev/SVGIconImageList/) 53 | 54 | You can also use StyledComponents, enabling STYLEDCOMPONENTS Compiler directive in the Demo. You must first download StyledComponents [here...](https://github.com/EtheaDev/StyledComponents/) 55 | 56 | ### Preview using StyledComponents with Rounded Buttons 57 | ![/Demo/Images/DemoPreviewStyledComponents.jpg](./Demo/Images/DemoPreviewStyledComponents.jpg) 58 | 59 | ### License 60 | 61 | this Demo is inspired by TSplitView demo (original software is Copyright (c) 2015 Embarcadero Technologies, Inc.) and is released under Apache 2.0 license. 62 | 63 | ![Delphi Support](./Demo/Images/SupportingDelphi.jpg) 64 | 65 | ## Compatibility ## 66 | 67 | **VCLThemeSelector** and **VCLThemeSelectorLauncher** are compatible from Delphi XE5 to 12, with some differences to High-DPI support. 68 | 69 | **ModernAppDemo** is compatible with Delphi Delphi 12, 11, 10.4, 10.3, 10.2 and 10.1 (notice: 10.1 png stream format of pictures inside biolife.xml are incompatible: use an old biolife.xml file). 70 | 71 | ## Release Notes ## 72 | 73 | 20 Nov 2024 74 | - Added support for Delphi 12.2 75 | - Fixed Font Loading fron Registry in DemoApp 76 | 77 | 26 Apr 2024 78 | - Added support for Delphi 12.1 79 | - Added StyledComponents integration 80 | - Added StyledComponents interposer in demo 81 | 82 | 20 Oct 2023 83 | - Added support for Delphi 12 84 | - Examples Built with Delphi 12 (beta) 85 | 86 | 04 Mar 2023 87 | - Built with Delphi 11.3 88 | - More VCL Styles supported 89 | 90 | 15 Sep 2022 91 | - Built with Delphi 11.2 92 | 93 | 10 Apr 2022 94 | - Built with Delphi 11.1 95 | - Fixed Size of menu when resize icons 96 | 97 | 16 Feb 2022 98 | - Added italian translation 99 | - SetEditorStyleAttributes to assign required/readonly attributes to edit controls 100 | - Added pixelsperinch when storing font 101 | - Added RegisterThemeAttributes to interface to add personal Styles 102 | 103 | 19 Oct 2021 104 | - Replaced "Windows11 Light" and "Windows11 Dark" Styles with "Windows11 Modern Light" and "Windows11 Modern Dark" 105 | - Updated demos to use new Windows 11 Styles available from Get-It 106 | 107 | 16 Oct 2021 108 | - Added New Windows11 Light and Dark Themes to Modern Demo (Delphi 11) 109 | - Added New Windows11 Light and Dark Themes to Launcher (Delphi 11) 110 | 111 | 23 Aug 2021 112 | - Added support for Delphi 11 113 | 114 | 24 Jan 2021 115 | - Changed preview to separate Light and Dark Themes 116 | - Added support for info about Themes: 117 | TThemeAttribute = class 118 | StyleName: String; 119 | ThemeType: TThemeType; 120 | EditRequiredColor: TColor; 121 | EditReadonlyColor: TColor; 122 | end; 123 | 124 | 30 Aug 2020 125 | - Changed demo to use new IconsFontsVirtualImageList and SVGIconVirtualImageList components 126 | - Updated external project VCLStyleUtils 127 | 128 | 19 Jun 2020 129 | - Fixed VCLThemeSelector for app in "Windows" Style for D10.4 130 | - Recompiled Demo with IconFontsImageList 2.0 (with GDI+ support) 131 | 132 | 11 Jun 2020 133 | - Added SVGIconImageList 134 | - Demo: swith icons from Fonts to SVG 135 | 136 | 09 Jun 2020 137 | - Updated Demo for Delphi 10.4 138 | - Added custom form "per-control styled" for D10.4 139 | 140 | 17 May 2020 141 | - Changed "Material Design Desktop" Font used in Demo 142 | 143 | 27 Apr 2020 144 | - Added VCLThemeSelectorLauncher 145 | 146 | 25 Apr 2020 147 | - First release of Selector and Demo App 148 | -------------------------------------------------------------------------------- /Source/CBVCLStylePreviewForm.dfm: -------------------------------------------------------------------------------- 1 | object CBVCLPreviewForm: TCBVCLPreviewForm 2 | Left = 0 3 | Top = 0 4 | BorderIcons = [biSystemMenu] 5 | ClientHeight = 122 6 | ClientWidth = 354 7 | Color = clBtnFace 8 | DoubleBuffered = True 9 | Font.Charset = DEFAULT_CHARSET 10 | Font.Color = clWindowText 11 | Font.Height = -11 12 | Font.Name = 'Tahoma' 13 | Font.Style = [] 14 | Menu = MainMenu 15 | OnCloseQuery = FormCloseQuery 16 | OnCreate = FormCreate 17 | OnShow = FormShow 18 | TextHeight = 13 19 | object TabControl: TTabControl 20 | Left = 0 21 | Top = 0 22 | Width = 354 23 | Height = 122 24 | Align = alClient 25 | TabOrder = 0 26 | Tabs.Strings = ( 27 | 'Page1' 28 | 'Page2' 29 | 'Page3') 30 | TabIndex = 0 31 | ExplicitWidth = 350 32 | ExplicitHeight = 121 33 | object FNormalTextEdit: TEdit 34 | Left = 8 35 | Top = 32 36 | Width = 80 37 | Height = 21 38 | TabOrder = 0 39 | Text = 'Normal' 40 | end 41 | object FButtonNormal: TButton 42 | Left = 8 43 | Top = 60 44 | Width = 75 45 | Height = 25 46 | Caption = 'Normal' 47 | TabOrder = 3 48 | OnMouseDown = FButtonNormalMouseDown 49 | OnMouseEnter = FButtonNormalMouseEnter 50 | OnMouseLeave = FButtonNormalMouseLeave 51 | OnMouseUp = FButtonNormalMouseUp 52 | end 53 | object FButtonDisabled: TButton 54 | Left = 94 55 | Top = 60 56 | Width = 75 57 | Height = 25 58 | Caption = 'Disabled' 59 | Enabled = False 60 | TabOrder = 4 61 | end 62 | object FRequiredTextEdit: TEdit 63 | Left = 94 64 | Top = 32 65 | Width = 80 66 | Height = 21 67 | TabOrder = 1 68 | Text = 'Required' 69 | end 70 | object FReadOnlyTextEdit: TEdit 71 | Left = 182 72 | Top = 32 73 | Width = 80 74 | Height = 21 75 | TabOrder = 2 76 | Text = 'ReadOnly' 77 | end 78 | object CheckBox: TCheckBox 79 | Left = 182 80 | Top = 60 81 | Width = 97 82 | Height = 17 83 | Caption = 'Check' 84 | Checked = True 85 | State = cbChecked 86 | TabOrder = 5 87 | end 88 | object ScrollBar: TScrollBar 89 | Left = 4 90 | Top = 101 91 | Width = 346 92 | Height = 17 93 | Align = alBottom 94 | PageSize = 0 95 | TabOrder = 6 96 | ExplicitTop = 100 97 | ExplicitWidth = 342 98 | end 99 | end 100 | object MainMenu: TMainMenu 101 | Left = 216 102 | Top = 32 103 | object FMenu1: TMenuItem 104 | Caption = 'File' 105 | end 106 | object FMenu2: TMenuItem 107 | Caption = 'Edit' 108 | end 109 | object FMenu3: TMenuItem 110 | Caption = 'View' 111 | end 112 | object FMenu4: TMenuItem 113 | Caption = 'Help' 114 | end 115 | end 116 | end 117 | -------------------------------------------------------------------------------- /Source/CBVCLStylePreviewForm.pas: -------------------------------------------------------------------------------- 1 | {******************************************************************************} 2 | { } 3 | { CBVCLStylePreviewForm: Example Preview of a VCL Style } 4 | { based on: VCLStylePreview Vcl.Styles.Ext } 5 | { https://github.com/RRUZ/vcl-styles-utils/ } 6 | { } 7 | { Copyright (c) 2020-2024 (Ethea S.r.l.) } 8 | { Author: Carlo Barazzetta } 9 | { } 10 | { https://github.com/EtheaDev/VCLThemeSelector } 11 | { } 12 | {******************************************************************************} 13 | { } 14 | { Licensed under the Apache License, Version 2.0 (the "License"); } 15 | { you may not use this file except in compliance with the License. } 16 | { You may obtain a copy of the License at } 17 | { } 18 | { http://www.apache.org/licenses/LICENSE-2.0 } 19 | { } 20 | { Unless required by applicable law or agreed to in writing, software } 21 | { distributed under the License is distributed on an "AS IS" BASIS, } 22 | { WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } 23 | { See the License for the specific language governing permissions and } 24 | { limitations under the License. } 25 | { } 26 | {******************************************************************************} 27 | unit CBVCLStylePreviewForm; 28 | 29 | {$Include VCLThemeSelector.inc} 30 | 31 | interface 32 | 33 | Uses 34 | System.Classes, 35 | System.Sysutils, 36 | System.Generics.Collections, 37 | System.Types, 38 | Winapi.Windows, 39 | Vcl.Styles, 40 | Vcl.Themes, 41 | Vcl.Forms, 42 | vcl.Menus, 43 | Vcl.Graphics, 44 | Vcl.Controls, 45 | Vcl.ExtCtrls, 46 | Vcl.StdCtrls, 47 | Vcl.ComCtrls; 48 | 49 | const 50 | PREVIEW_HEIGHT = 190; //At 96 DPI 51 | PREVIEW_WIDTH = 300; //At 96 DPI 52 | 53 | type 54 | TCBVCLPreviewForm = class(TForm) 55 | MainMenu: TMainMenu; 56 | FMenu1: TMenuItem; 57 | FMenu2: TMenuItem; 58 | FMenu3: TMenuItem; 59 | FMenu4: TMenuItem; 60 | TabControl: TTabControl; 61 | FNormalTextEdit: TEdit; 62 | FButtonNormal: TButton; 63 | FButtonDisabled: TButton; 64 | FRequiredTextEdit: TEdit; 65 | ScrollBar: TScrollBar; 66 | FReadOnlyTextEdit: TEdit; 67 | CheckBox: TCheckBox; 68 | procedure FormShow(Sender: TObject); 69 | procedure FormCreate(Sender: TObject); 70 | procedure FButtonNormalMouseEnter(Sender: TObject); 71 | procedure FButtonNormalMouseLeave(Sender: TObject); 72 | procedure FButtonNormalMouseDown(Sender: TObject; Button: TMouseButton; 73 | Shift: TShiftState; X, Y: Integer); 74 | procedure FButtonNormalMouseUp(Sender: TObject; Button: TMouseButton; 75 | Shift: TShiftState; X, Y: Integer); 76 | procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); 77 | private 78 | FButtonNormalCaption: string; 79 | FButtonHotCaption: string; 80 | FButtonPressedCaption: string; 81 | FCustomStyle: TCustomStyleServices; 82 | { Private declarations } 83 | public 84 | procedure SetCaptions(const ACaptions: string); 85 | property CustomStyle: TCustomStyleServices read FCustomStyle Write FCustomStyle; 86 | end; 87 | 88 | implementation 89 | 90 | {$R *.dfm} 91 | 92 | { TCBVCLPreviewForm } 93 | 94 | procedure TCBVCLPreviewForm.FButtonNormalMouseDown(Sender: TObject; 95 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 96 | begin 97 | FButtonNormal.Caption := FButtonPressedCaption; 98 | end; 99 | 100 | procedure TCBVCLPreviewForm.FButtonNormalMouseEnter(Sender: TObject); 101 | begin 102 | FButtonNormal.Caption := FButtonHotCaption; 103 | end; 104 | 105 | procedure TCBVCLPreviewForm.FButtonNormalMouseLeave(Sender: TObject); 106 | begin 107 | FButtonNormal.Caption := FButtonNormalCaption; 108 | end; 109 | 110 | procedure TCBVCLPreviewForm.FButtonNormalMouseUp(Sender: TObject; 111 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 112 | begin 113 | FButtonNormal.Caption := FButtonHotCaption; 114 | end; 115 | 116 | procedure TCBVCLPreviewForm.FormCloseQuery(Sender: TObject; 117 | var CanClose: Boolean); 118 | begin 119 | CanClose := False; 120 | end; 121 | 122 | procedure TCBVCLPreviewForm.FormCreate(Sender: TObject); 123 | begin 124 | ; 125 | end; 126 | 127 | procedure TCBVCLPreviewForm.FormShow(Sender: TObject); 128 | begin 129 | Self.StyleName := FCustomStyle.Name; 130 | Visible := True; 131 | end; 132 | 133 | procedure TCBVCLPreviewForm.SetCaptions(const ACaptions: string); 134 | var 135 | LCaptions: TStringList; 136 | begin 137 | LCaptions := TStringList.Create; 138 | LCaptions.Text := ACaptions; 139 | try 140 | if LCaptions.Count > 0 then //File 141 | FMenu1.Caption := LCaptions.Strings[0]; 142 | 143 | if LCaptions.Count > 1 then //Edit 144 | FMenu2.Caption := LCaptions.Strings[1]; 145 | 146 | if LCaptions.Count > 2 then //View 147 | FMenu3.Caption := LCaptions.Strings[2]; 148 | 149 | if LCaptions.Count > 3 then //Help 150 | FMenu4.Caption := LCaptions.Strings[3]; 151 | 152 | if LCaptions.Count > 4 then //Text editor 153 | FNormalTextEdit.Text := LCaptions.Strings[4]; 154 | 155 | if LCaptions.Count > 5 then //Normal 156 | begin 157 | FButtonNormalCaption := LCaptions.Strings[5]; 158 | FButtonNormal.Caption := FButtonNormalCaption; 159 | end; 160 | 161 | if LCaptions.Count > 6 then //Hot 162 | FButtonHotCaption := LCaptions.Strings[6]; 163 | 164 | if LCaptions.Count > 7 then //Pressed 165 | FButtonPressedCaption := LCaptions.Strings[7]; 166 | 167 | if LCaptions.Count > 8 then //Disabled 168 | FButtonDisabled.Caption := LCaptions.Strings[8]; 169 | 170 | if LCaptions.Count > 9 then //Required 171 | FRequiredTextEdit.Text := LCaptions.Strings[9]; 172 | 173 | if LCaptions.Count > 10 then //Readonly 174 | FReadOnlyTextEdit.Text := LCaptions.Strings[10]; 175 | 176 | if LCaptions.Count > 11 then //Check 177 | CheckBox.Caption := LCaptions.Strings[11]; 178 | 179 | if LCaptions.Count > 12 then //Page 1 180 | Tabcontrol.Tabs[0] := LCaptions.Strings[12]; 181 | 182 | if LCaptions.Count > 13 then //Page 2 183 | Tabcontrol.Tabs[1] := LCaptions.Strings[13]; 184 | 185 | if LCaptions.Count > 14 then //Page 3 186 | Tabcontrol.Tabs[2] := LCaptions.Strings[14]; 187 | 188 | finally 189 | LCaptions.Free; 190 | end; 191 | end; 192 | 193 | end. 194 | -------------------------------------------------------------------------------- /Source/FVCLThemeSelector.dfm: -------------------------------------------------------------------------------- 1 | object VCLThemeSelectorForm: TVCLThemeSelectorForm 2 | Left = 0 3 | Top = 0 4 | Hint = 'Select theme by clicking on the name' 5 | Caption = 'Select Light or Dark theme' 6 | ClientHeight = 501 7 | ClientWidth = 1061 8 | Color = clBtnFace 9 | ParentFont = True 10 | Position = poScreenCenter 11 | ShowHint = True 12 | OnCreate = FormCreate 13 | OnResize = FormResize 14 | TextHeight = 15 15 | object paButtons: TPanel 16 | Left = 0 17 | Top = 463 18 | Width = 1061 19 | Height = 38 20 | Align = alBottom 21 | BevelOuter = bvNone 22 | TabOrder = 0 23 | object StyleLabel: TPanel 24 | AlignWithMargins = True 25 | Left = 3 26 | Top = 3 27 | Width = 859 28 | Height = 32 29 | Align = alClient 30 | Alignment = taRightJustify 31 | BevelOuter = bvNone 32 | Caption = 'New selected theme: %s' 33 | TabOrder = 1 34 | end 35 | object paRight: TPanel 36 | Left = 865 37 | Top = 0 38 | Width = 196 39 | Height = 38 40 | Align = alRight 41 | BevelOuter = bvNone 42 | TabOrder = 0 43 | object btApply: TButton 44 | Left = 3 45 | Top = 5 46 | Width = 88 47 | Height = 29 48 | Action = acApplyStyle 49 | Default = True 50 | TabOrder = 0 51 | end 52 | object btCancel: TButton 53 | Left = 97 54 | Top = 4 55 | Width = 88 56 | Height = 29 57 | Action = acCancel 58 | Cancel = True 59 | TabOrder = 1 60 | end 61 | end 62 | end 63 | object LeftScrollBox: TScrollBox 64 | Left = 0 65 | Top = 25 66 | Width = 537 67 | Height = 438 68 | Align = alLeft 69 | TabOrder = 1 70 | OnMouseWheel = ScrollBoxMouseWheel 71 | object LeftFlowPanel: TFlowPanel 72 | Left = 0 73 | Top = 0 74 | Width = 533 75 | Height = 400 76 | Align = alTop 77 | AutoSize = True 78 | BevelOuter = bvNone 79 | BiDiMode = bdLeftToRight 80 | ParentBiDiMode = False 81 | TabOrder = 0 82 | end 83 | end 84 | object RightScrollBox: TScrollBox 85 | Left = 537 86 | Top = 25 87 | Width = 524 88 | Height = 438 89 | Align = alClient 90 | TabOrder = 2 91 | OnMouseWheel = ScrollBoxMouseWheel 92 | object RightFlowPanel: TFlowPanel 93 | Left = 0 94 | Top = 0 95 | Width = 520 96 | Height = 400 97 | Align = alTop 98 | AutoSize = True 99 | BevelOuter = bvNone 100 | BiDiMode = bdLeftToRight 101 | ParentBiDiMode = False 102 | TabOrder = 0 103 | end 104 | end 105 | object TopPanel: TPanel 106 | Left = 0 107 | Top = 0 108 | Width = 1061 109 | Height = 25 110 | Align = alTop 111 | TabOrder = 3 112 | object LightPanel: TPanel 113 | Left = 1 114 | Top = 1 115 | Width = 536 116 | Height = 23 117 | Align = alLeft 118 | BevelOuter = bvLowered 119 | Caption = 'Light Themes' 120 | TabOrder = 0 121 | end 122 | object DarkPanel: TPanel 123 | Left = 537 124 | Top = 1 125 | Width = 523 126 | Height = 23 127 | Align = alClient 128 | BevelOuter = bvLowered 129 | Caption = 'Dark Themes' 130 | TabOrder = 1 131 | end 132 | end 133 | object ActionListAppereance: TActionList 134 | Left = 488 135 | Top = 168 136 | object acApplyStyle: TAction 137 | Category = 'Settings' 138 | Caption = 'Apply' 139 | Hint = 'Apply selected Theme' 140 | ImageIndex = 71 141 | OnExecute = acApplyStyleExecute 142 | OnUpdate = acApplyStyleUpdate 143 | end 144 | object acCancel: TAction 145 | Category = 'Settings' 146 | Caption = 'Cancel' 147 | Hint = 'Cancel selection' 148 | ImageIndex = 10 149 | OnExecute = acCancelExecute 150 | end 151 | end 152 | end 153 | -------------------------------------------------------------------------------- /Source/VCLThemeSelector.inc: -------------------------------------------------------------------------------- 1 | // Delphi 10.1 Berlin 2 | {$IFDEF VER310} 3 | {$DEFINE D10_1+} 4 | {$ENDIF} 5 | 6 | // Delphi 10.2 Tokyo 7 | {$IFDEF VER320} 8 | {$DEFINE D10_1+} 9 | {$DEFINE D10_2+} 10 | {$ENDIF} 11 | 12 | // Delphi 10.3 13 | {$IFDEF VER330} 14 | {$DEFINE D10_1+} 15 | {$DEFINE D10_2+} 16 | {$DEFINE D10_3+} 17 | {$ENDIF} 18 | 19 | // Delphi 10.4 20 | {$IFDEF VER340} 21 | {$DEFINE D10_1+} 22 | {$DEFINE D10_2+} 23 | {$DEFINE D10_3+} 24 | {$DEFINE D10_4+} 25 | {$ENDIF} 26 | 27 | // Delphi 11.0 28 | {$IFDEF VER350} 29 | {$DEFINE D10_1+} 30 | {$DEFINE D10_2+} 31 | {$DEFINE D10_3+} 32 | {$DEFINE D10_4+} 33 | {$DEFINE D11+} 34 | {$ENDIF} 35 | 36 | // Delphi 12.0 37 | {$IFDEF VER360} 38 | {$DEFINE D10_1+} 39 | {$DEFINE D10_2+} 40 | {$DEFINE D10_3+} 41 | {$DEFINE D10_4+} 42 | {$DEFINE D11+} 43 | {$DEFINE D12+} 44 | {$ENDIF} 45 | 46 | -------------------------------------------------------------------------------- /TestFontDPI/ChildUnit.dfm: -------------------------------------------------------------------------------- 1 | object ChildForm: TChildForm 2 | Left = 0 3 | Top = 0 4 | Caption = 'ChildForm' 5 | ClientHeight = 299 6 | ClientWidth = 588 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | OldCreateOrder = False 14 | OnAfterMonitorDpiChanged = FormAfterMonitorDpiChanged 15 | OnCreate = FormCreate 16 | OnShow = FormShow 17 | PixelsPerInch = 96 18 | TextHeight = 13 19 | object Label1: TLabel 20 | Left = 0 21 | Top = 0 22 | Width = 588 23 | Height = 258 24 | Align = alClient 25 | AutoSize = False 26 | Caption = 'Label1' 27 | ExplicitWidth = 561 28 | end 29 | object Panel1: TPanel 30 | Left = 0 31 | Top = 258 32 | Width = 588 33 | Height = 41 34 | Align = alBottom 35 | BevelOuter = bvLowered 36 | TabOrder = 0 37 | DesignSize = ( 38 | 588 39 | 41) 40 | object Edit1: TEdit 41 | Left = 8 42 | Top = 8 43 | Width = 281 44 | Height = 21 45 | TabOrder = 0 46 | Text = 'Edit1' 47 | end 48 | object Button1: TButton 49 | Left = 448 50 | Top = 6 51 | Width = 131 52 | Height = 25 53 | Action = acCloseChildForm 54 | Anchors = [akTop, akRight] 55 | TabOrder = 1 56 | end 57 | end 58 | object ActionList: TActionList 59 | OnUpdate = ActionListUpdate 60 | Left = 288 61 | Top = 128 62 | object acCloseChildForm: TAction 63 | Caption = 'Close Child Form' 64 | OnExecute = acCloseChildFormExecute 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /TestFontDPI/ChildUnit.pas: -------------------------------------------------------------------------------- 1 | unit ChildUnit; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, 8 | System.Actions, Vcl.ActnList; 9 | 10 | type 11 | TChildForm = class(TForm) 12 | Label1: TLabel; 13 | Panel1: TPanel; 14 | Edit1: TEdit; 15 | ActionList: TActionList; 16 | acCloseChildForm: TAction; 17 | Button1: TButton; 18 | procedure acCloseChildFormExecute(Sender: TObject); 19 | procedure ActionListUpdate(Action: TBasicAction; var Handled: Boolean); 20 | procedure FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, 21 | NewDPI: Integer); 22 | procedure FormCreate(Sender: TObject); 23 | procedure FormShow(Sender: TObject); 24 | private 25 | protected 26 | procedure Loaded; override; 27 | public 28 | procedure AfterConstruction; override; 29 | procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; 30 | end; 31 | 32 | var 33 | ChildForm: TChildForm; 34 | 35 | implementation 36 | 37 | {$R *.dfm} 38 | 39 | uses 40 | MainUnit; 41 | 42 | 43 | procedure TChildForm.acCloseChildFormExecute(Sender: TObject); 44 | begin 45 | Close; 46 | end; 47 | 48 | procedure TChildForm.ActionListUpdate(Action: TBasicAction; 49 | var Handled: Boolean); 50 | begin 51 | UpdateLabel(Self, Label1, Edit1, Panel1); 52 | end; 53 | 54 | procedure TChildForm.AfterConstruction; 55 | begin 56 | inherited; 57 | end; 58 | 59 | procedure TChildForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, 60 | NewDPI: Integer); 61 | begin 62 | if ParentFont and (Application.MainForm.Monitor.Handle <> Self.Monitor.Handle) then 63 | Font.Height := MulDiv(Font.Height, NewDPI, OldDPI); 64 | end; 65 | 66 | procedure TChildForm.FormCreate(Sender: TObject); 67 | begin 68 | //Change size of form for 600x400 at 96 DPI 69 | ClientWidth := MulDiv(600, Self.Monitor.PixelsPerInch, Self.PixelsPerInch); 70 | ClientHeight := MulDiv(400, Self.Monitor.PixelsPerInch, Self.PixelsPerInch); 71 | //ClientWidth := MulDiv(600, Screen.PixelsPerInch, Self.PixelsPerInch); 72 | //ClientHeight := MulDiv(400, Screen.PixelsPerInch, Self.PixelsPerInch); 73 | end; 74 | 75 | procedure TChildForm.FormShow(Sender: TObject); 76 | begin 77 | //Only after FormAfterMonitorDpiChanged you can change Font attributes, because ParentFont goes to False 78 | Font.Color := clRed; 79 | end; 80 | 81 | procedure TChildForm.Loaded; 82 | begin 83 | //Ensure ParentFont always True for Child Forms 84 | ParentFont := True; 85 | 86 | inherited; 87 | end; 88 | 89 | procedure TChildForm.SetBounds(ALeft, ATop, AWidth, AHeight: Integer); 90 | begin 91 | inherited; 92 | ; 93 | end; 94 | 95 | 96 | 97 | end. 98 | -------------------------------------------------------------------------------- /TestFontDPI/MainUnit.dfm: -------------------------------------------------------------------------------- 1 | object MainForm: TMainForm 2 | Left = 0 3 | Top = 0 4 | Caption = 'MainForm' 5 | ClientHeight = 299 6 | ClientWidth = 588 7 | Color = clBtnFace 8 | ParentFont = True 9 | OnAfterMonitorDpiChanged = FormAfterMonitorDpiChanged 10 | OnShow = FormShow 11 | TextHeight = 15 12 | object Label1: TLabel 13 | Left = 0 14 | Top = 0 15 | Width = 588 16 | Height = 258 17 | Align = alClient 18 | AutoSize = False 19 | Caption = 'Label1' 20 | WordWrap = True 21 | ExplicitTop = 2 22 | end 23 | object Panel1: TPanel 24 | Left = 0 25 | Top = 258 26 | Width = 588 27 | Height = 41 28 | Align = alBottom 29 | BevelOuter = bvLowered 30 | TabOrder = 0 31 | ExplicitTop = 257 32 | ExplicitWidth = 584 33 | DesignSize = ( 34 | 588 35 | 41) 36 | object Edit1: TEdit 37 | Left = 8 38 | Top = 8 39 | Width = 281 40 | Height = 23 41 | TabOrder = 0 42 | Text = 'Edit1' 43 | end 44 | object Button1: TButton 45 | Left = 448 46 | Top = 6 47 | Width = 131 48 | Height = 25 49 | Action = acOpenChildForm 50 | Anchors = [akTop, akRight] 51 | TabOrder = 1 52 | ExplicitLeft = 444 53 | end 54 | end 55 | object ActionList: TActionList 56 | OnUpdate = ActionListUpdate 57 | Left = 288 58 | Top = 128 59 | object acOpenChildForm: TAction 60 | Caption = 'Open Child Form' 61 | OnExecute = acOpenChildFormExecute 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /TestFontDPI/MainUnit.pas: -------------------------------------------------------------------------------- 1 | unit MainUnit; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, 8 | System.Actions, Vcl.ActnList; 9 | 10 | type 11 | TMainForm = class(TForm) 12 | Label1: TLabel; 13 | Panel1: TPanel; 14 | Edit1: TEdit; 15 | ActionList: TActionList; 16 | acOpenChildForm: TAction; 17 | Button1: TButton; 18 | procedure FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, 19 | NewDPI: Integer); 20 | procedure FormShow(Sender: TObject); 21 | procedure Label1Click(Sender: TObject); 22 | procedure ActionListUpdate(Action: TBasicAction; var Handled: Boolean); 23 | procedure acOpenChildFormExecute(Sender: TObject); 24 | private 25 | FStart, FEnd: TDateTime; 26 | procedure UpdateDefaultAndSystemFonts; 27 | protected 28 | procedure Loaded; override; 29 | public 30 | procedure BuildLabels; 31 | constructor Create(AOwner: TComponent); override; 32 | end; 33 | 34 | var 35 | MainForm: TMainForm; 36 | 37 | procedure UpdateLabel(AForm: TForm; ALabel: TLabel; AEdit: TEdit; 38 | APanel: TPanel); 39 | 40 | implementation 41 | 42 | {$R *.dfm} 43 | 44 | uses 45 | ChildUnit; 46 | 47 | procedure UpdateLabel(AForm: TForm; ALabel: TLabel; AEdit: TEdit; 48 | APanel: TPanel); 49 | begin 50 | ALabel.Caption := Format( 51 | 'Parent: %d%s'+ 52 | 'Screen.IconFont.Height: %d%s'+ 53 | 'Screen.IconFont.PixelsPerInch: %d%s'+ 54 | 'App.DefaultFont.Height: %d%s'+ 55 | 'App.DefaultFont.PixelsPerInch: %d%s'+ 56 | 'Font.Height: %d%s'+ 57 | 'Font.PixelsPerInch: %d%s'+ 58 | 'Font.Size: %d%s'+ 59 | 'Font.Name: %s%s'+ 60 | 'Edit.Font.Height: %d%s'+ 61 | 'Edit.Height: %d%s'+ 62 | 'Panel.Height: %d%s'+ 63 | 'Scale Factor: %1.2f - MonitorPPI. %d', 64 | [Ord(AForm.ParentFont),sLineBreak, 65 | Screen.IconFont.Height,sLineBreak, 66 | Screen.IconFont.PixelsPerInch,sLineBreak, 67 | Application.DefaultFont.Height,sLineBreak, 68 | Application.DefaultFont.PixelsPerInch,sLineBreak, 69 | AForm.Font.Height,sLineBreak, 70 | AForm.Font.pixelsperinch,sLineBreak, 71 | AForm.Font.Size,sLineBreak, 72 | AForm.Font.Name,sLineBreak, 73 | AEdit.Font.Height,sLineBreak, 74 | AEdit.Height,sLineBreak, 75 | APanel.Height,sLineBreak, 76 | AForm.ScaleFactor, AForm.Monitor.PixelsPerInch]); 77 | 78 | AForm.Caption := Format('ClientWidth:%d - ClientHeight:%d',[ 79 | AForm.ClientWidth, AForm.ClientHeight]); 80 | end; 81 | 82 | procedure TMainForm.acOpenChildFormExecute(Sender: TObject); 83 | begin 84 | ChildForm := TChildForm.Create(nil); 85 | try 86 | ChildForm.ShowModal; 87 | finally 88 | ChildForm.Free; 89 | end; 90 | end; 91 | 92 | procedure TMainForm.ActionListUpdate(Action: TBasicAction; 93 | var Handled: Boolean); 94 | begin 95 | UpdateLabel(Self, Label1, Edit1, Panel1); 96 | end; 97 | 98 | procedure TMainForm.UpdateDefaultAndSystemFonts; 99 | var 100 | LHeight: Integer; 101 | begin 102 | //Update Application.DefaultFont used by ChildForms with ParentFont = True 103 | Application.DefaultFont.Assign(Font); 104 | //Update system fonts as user preferences (without using Assign!) 105 | LHeight := Muldiv(Font.Height, Screen.PixelsPerInch, Monitor.PixelsPerInch); 106 | Screen.IconFont.Name := Font.Name; 107 | Screen.IconFont.Height := LHeight; 108 | Screen.MenuFont.Name := Font.Name; 109 | Screen.MenuFont.Height := LHeight; 110 | Screen.MessageFont.Name := Font.Name; 111 | Screen.MessageFont.Height := LHeight; 112 | Screen.HintFont.Name := Font.Name; 113 | Screen.HintFont.Height := LHeight; 114 | Screen.CaptionFont.Name := Font.Name; 115 | Screen.CaptionFont.Height := LHeight; 116 | end; 117 | 118 | procedure TMainForm.BuildLabels; 119 | var 120 | i: Integer; 121 | begin 122 | inherited; 123 | for I := 0 to 1000 do 124 | begin 125 | with TLabel.Create(Self) do 126 | begin 127 | Caption := 'Label: '+IntToStr(I); 128 | Parent := Self; 129 | SetBounds(I*10,I*10,100,100); 130 | end; 131 | end; 132 | end; 133 | 134 | constructor TMainForm.Create(AOwner: TComponent); 135 | var 136 | i: Integer; 137 | begin 138 | FStart := Now; 139 | inherited; 140 | //BuildLabels; 141 | end; 142 | 143 | procedure TMainForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, 144 | NewDPI: Integer); 145 | begin 146 | inherited; 147 | UpdateDefaultAndSystemFonts; 148 | end; 149 | 150 | procedure TMainForm.FormShow(Sender: TObject); 151 | var 152 | H,M,S,MS: Word; 153 | begin 154 | FEnd := Now; 155 | DecodeTime((FEnd - fStart),H,M,S,MS); 156 | Caption := Caption + Format('W:%d - H:%d - %d.%d sec.',[ 157 | ClientWidth, ClientHeight, S, MS]); 158 | end; 159 | 160 | procedure TMainForm.Label1Click(Sender: TObject); 161 | begin 162 | acOpenChildForm.Execute; 163 | end; 164 | 165 | procedure TMainForm.Loaded; 166 | begin 167 | //Very important for HighDPI: on Main Screen ParentFont must be always be False 168 | ParentFont := False; 169 | 170 | //Acquire system font and size (eg. for windows 10 Segoe UI and 14 at 96 DPI) 171 | //but without using Assign! 172 | Font.Name := Screen.IconFont.Name; 173 | //If you want to use system font Height: 174 | Font.Height := Muldiv(Screen.IconFont.Height, 96, Screen.IconFont.PixelsPerInch); 175 | 176 | (* 177 | //Sample assign Font by user preferences: 178 | Font.Name := 'Century Gothic'; 179 | Font.Color := clBlue; 180 | Font.Height := -14; 181 | *) 182 | 183 | inherited; 184 | 185 | //For Child Forms with ParentFont = True 186 | UpdateDefaultAndSystemFonts; 187 | 188 | //Test build run-time components 189 | //BuildLabels; 190 | end; 191 | 192 | end. 193 | -------------------------------------------------------------------------------- /TestFontDPI/TestFontDPI.dpr: -------------------------------------------------------------------------------- 1 | program TestFontDPI; 2 | 3 | uses 4 | Vcl.Forms, 5 | MainUnit in 'MainUnit.pas' {MainForm}, 6 | ChildUnit in 'ChildUnit.pas' {ChildForm}; 7 | 8 | {$R *.res} 9 | 10 | begin 11 | Application.Initialize; 12 | Application.CreateForm(TMainForm, MainForm); 13 | Application.MainFormOnTaskbar := True; 14 | Application.Run; 15 | end. 16 | -------------------------------------------------------------------------------- /TestFontDPI/TestFontDPI.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EtheaDev/VCLThemeSelector/dc0834e7b2c6bdfb51cbc9a11ecba8c097afc364/TestFontDPI/TestFontDPI.res --------------------------------------------------------------------------------