19 May
Let's fix the ToggleSwitch with style !

Delphi 10.4.2 is a great release, super fast and efficient, I like it a lot.

But VCL Styles got reworked to support high DPI and the toggleswitch component got forgotten and cropped in the process, especially for Windows 10 styles, like here "SlateGray".

If your application relies on styles and uses many ToggleSwitches you won't be happy. Instead of looking great it now looks bad.

You're stuck until next release ... wait for a bugfix, sorry.

Lol, no this is an easy one, and you can fix it yourself. Go in the tools menu and find the "Style bitmap designer"

You can find your Styles here C:\Program Files (x86)\Embarcadero\Studio\21.0\Redist\styles\vcl  make a copy and open the faulty one in the designer.

There, you have a treeview, in objects you'll find the Toggleswitch at the end

For each sub items open the "bitmaps" in the inspector to the right.

Change the zoom to 400% and follow the dotted lines, you'll see the position is offset, the coordinates (187:523)-(217:547) are wrong.

Now for each "bitmap" use the left mouse button to set TopLeft position and right mouse button to set correct BottomRight position.

Save the fixed style, et voilà !

And now you say "Hey my toggle thumb does not look great like this it is still cropped !" 

Yes, it's because the thumb size is not handled by the style, you have to change it in the component properties and set the ThumbWidth property to 20 instead of 15 by default.

Of course an alternative, if you look at the designer "images" -> Style.png bitmap, is to modify the style image and offset the ToggleSwitch drawings in a paint editor. (I recommend Paint.NET - Free Software for Digital Photo Editing (getpaint.net)  it should work too.

To do this use the export button to get a png image with transparency. Warning, since png has transparency once you update the image and get a message asking you to select a transparency color ... don't select anything or it will mess everything up, just import and keep your transparency.

Have fun ;-)

PS : Getit additionnal Styles are located elsewhere, look here C:\Users\...\Documents\Embarcadero\Studio\21.0\CatalogRepository

Comments
* The email will not be published on the website.
I BUILT MY SITE FOR FREE USING