Carlo Barazzetta 116 Posted September 3, 2020 (edited) I have a question about a problem developing SVGIconImageList components: At design-time, the component editor cannot show the svg icon preview into the OpenDialog when loading files from "Add..." button.Compiling the demo, *and* and activating any VCLStyle, the icon is visibile: Disabling the VCL style, the preview is not visible also at run-time (I'm using Windows in dark mode): Could it be possible to have the same functionality at design time? It is very important to see the preview, during selection of svg files using the editor! Do I need some OpenDialog "hook" to have the preview also in "normal" style? Thansk for any suggestions. Carlo Edited September 3, 2020 by Carlo Barazzetta Share this post Link to post
pyscripter 689 Posted September 3, 2020 (edited) It should be mentioned that one of the package units registers the new file format: initialization TPicture.RegisterFileFormat('SVG', 'Scalable Vector Graphics', TSVGGraphic); Use PowerToys to get SVG preview at run time when you disable Vcl styles. (Also in File Explorer) Edited September 3, 2020 by pyscripter 1 Share this post Link to post
Carlo Barazzetta 116 Posted September 3, 2020 1 hour ago, pyscripter said: It should be mentioned that one of the package units registers the new file format: initialization TPicture.RegisterFileFormat('SVG', 'Scalable Vector Graphics', TSVGGraphic); Yes! I've notice now that the two Dialog are quite different... but the call is always the same: OpenDialog.Execute. The TOpenDialog properties: object OpenDialog: TOpenPictureDialog Filter = 'Scalable Vector Graphics (*.svg)|*.svg' Options = [ofHideReadOnly, ofAllowMultiSelect, ofPathMustExist, ofFileMustExist, ofEnableSizing] Left = 328 Top = 96 end Share this post Link to post
Carlo Barazzetta 116 Posted September 3, 2020 (edited) Ok, I've resolved, with this solution: I'm using a new class, implementing Execute without call the "inherited" metod, because the "magic" OpenDialog with the preview is activated by : Template := 'DLGTEMPLATE' but it's used only when TStyleManager.IsCustomStyleActive Using Template 'DLGTEMPLATE' also without CustomStyleActive shows always the dialog with the preview: TOpenPictureDialogSvg = class(TOpenPictureDialog) function TOpenPictureDialogSvg.Execute(ParentWnd: HWND): Boolean; begin Template := 'DLGTEMPLATE'; Result := DoExecute(@GetOpenFileName, ParentWnd); end; Not very elegant, but it works... Edited September 3, 2020 by Carlo Barazzetta 1 Share this post Link to post
Sashka 0 Posted December 11, 2020 On 9/3/2020 at 1:49 PM, Carlo Barazzetta said: Could it be possible to have the same functionality at design time? It is very important to see the preview, during selection of svg files using the editor! Do I need some OpenDialog "hook" to have the preview also in "normal" style? Thansk for any suggestions. Carlo You need an interface IPreviewHandler implementation in COM DLL that supports displaying SVG-graphics After that you can use classic new TOpenDialog Share this post Link to post
Carlo Barazzetta 116 Posted February 11, 2021 Now with SVGShellExtensions (https://github.com/EtheaDev/SVGShellExtensions) the icons are visibile also into Internet Explorer as Thumbnails and Preview 😉 1 Share this post Link to post