-
Content Count
79 -
Joined
-
Last visited
-
Set StyleName for one single control, yet no style for the rest of the app
CyberPeter replied to CyberPeter's topic in VCL
Perhaps it's best I show what I mean. Fairly sure nobody finds this pleasant (PS. none of this happens without a Style on the same (slow) system) Screen Recording (11-04-2025 11-15-58).mp4 -
Set StyleName for one single control, yet no style for the rest of the app
CyberPeter replied to CyberPeter's topic in VCL
I tried the suggested TStyleManager::UseSystemStyleAsDefault = true ; but that doesn't do anything unless I load a style just so that the style manager gets 'activated' : TStyleManager::TrySetStyle(L"Windows11 Modern Dark", false /*Do not show Error Message*/) ; which of course negatively affects other custom components that use the Style class to get color information about background etc. So in order to implement this, everything needs to be reviewed essentially. That's a bummer. -
Set StyleName for one single control, yet no style for the rest of the app
CyberPeter replied to CyberPeter's topic in VCL
It's just a general thing in more complex applications (I find), especially with ListView and TreeView etc. and especially when the computer runs a bit slower (had some pc fan issues and the reduced speed made it very obvious). In my applications styles are implemented to be able to support a dark theme but I personally prefer to use simply Windows for the best performance. For a static application with some buttons etc, styles can be nice, but for faster moving data, scrolling etc. Styles reduce the perceived quality of the application (in my view). When I dynamically create a form with lots of components on it (e.g. an Options Window) there is very obvious flicker as well while the window comes into view -
Set StyleName for one single control, yet no style for the rest of the app
CyberPeter replied to CyberPeter's topic in VCL
VCL yes. Thank you I will check out the article. -
Set StyleName for one single control, yet no style for the rest of the app
CyberPeter posted a topic in VCL
I can set a StyleName for a particular control, for instance: MyCustomControlDescendant->StyleName = L"Windows11 Modern Light" ; However, this only works if a Style has been applied application wide: TStyleManager::TrySetStyle() (Any Style) Usually I prefer no Style, because Styles do flicker a lot etc. But for a TrackBar for instance, an ugly control, a Style feels appropriate. Sadly assigning one to just the control via StyleName is not possible, unless I first load a style application wide My question, is it possible at all and if so, how ? -
Understood. So both TBitmap and TGIFImg take TImage.Transparent in account. From testing it looks like native Icon, PNG, tiff, wmf, and WIC support ignore this setting. For jpg I'm not even sure right now whether I use VCL or WIC (to be tested)
-
I had a minute today, too curious to let this be. I found an issue in my Stream and after I fixed it, the GIFs render fine with your component @Anders Melander Except perhaps that the background is not transparent for one of the GIFs. Left is via WIC, right is via GIFImg You see this too ?
-
Modern way to create splash screen from transparent png with edges that blend with the background
CyberPeter replied to CyberPeter's topic in General Help
The link still works for me too -
Thanks @Anders Melander, I will double check on Monday. I tried to finish too many things in the last few hours of the week. I now also build a list of WIC registered codecs. It's possible I made a mistake. Weird though that all the other formats work without issues. Only (embedded) GIF has an issue at the moment. The Offset is definitely set to 0 (not on my dev system, so can't check, but pretty sure). I'll put some breakpoints on Monday and will check my custom stream that pulls the data from various sources.
-
@Anders Melander Just signing off, Friday evening down under. I quickly included GIF again and built in 32bit and 64bit (Modern) LoadFromStream() seems to throw an exception after testing the first two bytes (I think - checked in haste) removing the include fixes the issue (use of WIC instead)
-
If I include GIFImg, Image->Picture->LoadFromStream() throws an exception on the two GIFs tried (Passed via a custom Stream) If I don't include GIFImg, all GIFs tested work fine, assuming WIC was used.
-
Will check the WIC API functions, thanks. FYI I experimented with built in GIF support but I have already disabled it again //#include <Vcl.Imaging.GIFImg.hpp> // For TGIFImage because WIC does a better job on the images that I tested
-
Interesting, thanks @vfbb For the time being at least I have completely disabled support for *.svg since I don't want to statically link to a third party dll. But good to know.
-
I arrived at this first iteration code: { String formats; static const TGraphicClass graphicClasses[] = { __classid(TBitmap), // BMP __classid(TJPEGImage), // JPG __classid(TPngImage), // PNG __classid(TMetafile), // WMF, EMF __classid(TIcon), // ICO __classid(TGIFImage), // GIF __classid(TWICImage), // TIF, TIFF }; constexpr int numClasses = sizeof(graphicClasses) / sizeof(graphicClasses[0]); for (int i = 0; i < numClasses; i++) { String mask = GraphicFileMask(graphicClasses[i]); if (!mask.IsEmpty()) { // Remove "*." from extensions mask = StringReplace(mask, L"*.", L"", TReplaceFlags() << rfReplaceAll); if (!formats.IsEmpty()) formats += L";"; formats += mask; } } return formats; } which reliably provides me this list: L"bmp;jpg;jpeg;png;emf;wmf;ico;gif;tif;tiff" which I can use to decide on providing a picture for a file or not Although I might as well hard code these since they are built in anyway I am not seeing the @Anders Melander mentioned external WIC extensions. Any idea how to get to those ? GraphicFileMask() on the WIC class only adds tif and tif @Remy Lebeau I suspect *.webp, just like cr2, erf, raf, 3fr, dcr, dng, mrw, nef, orf, raw, pef, srw, sr2 (and perhaps more) on my system are supported via mentioned external WIC class ? I just need to find a way to build up a list
-
> I would also unregister the TWICImage class (see UnregisterFileFormat) as support for all the formats it support might not be a good thing. All the formats will just confuse your users. It's not a picture viewing program as such. More of an extra feature if the functionality is available for that type picture (user needs to jump through hoops to get there). Example: So I will try to build a list of supported extensions on that system and use that list to make the functionality available for that file (or not) using this suggestion: > Calling GraphicFileMask(TGraphic) from Vcl.Graphics will give you a list of supported extensions. Though I still need to figure this out ?